Workerman 小蝌蚪聊天室去掉端口

Workerman是一款纯PHP开发的开源的PHP socket 服务器框架。

我们在配置聊天室的时候,按照框架作者的步骤,最后形成这样的URL  http://www.doname.com:8282

患有洁癖的我们怎么能允许这样的端口存在。实际上,可以不通过这样的方式访问。


通常,我们已经有很多个站点了,并且配置了泛域名*.dotname.com,比如可能是

http://www.dotname.com 

http://bbs.dotname.com 

http://blog.dotname.com 

.....等等。


现在多了一个基于Workerman的即时聊天室。


为了去掉端口号,我们在nginx原有的泛域名配置下添加一个配置项

原来我们的配置可能是这样的:

(前提在域名提供商我们已经配了*.dotname.com指向了我们服务器IP,不过你都到这步了应该是已经配了)

server {
    listen       80;
    server_name *.dotname.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root  /usr/nginx/html/com;
        index index.php index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/nginx/html/com;
        fastcgi_pass   127.0.0.1:9001;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }

}

我们在这后面加上:

server {
    listen       80;
    server_name wechatdemo.dotname.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root  /usr/nginx/html/workerman-todpole/Applications/Todpole/Web;
        index index.php index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/nginx/html/workerman-todpole/Applications/Todpole/Web;
        fastcgi_pass   127.0.0.1:9001;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }


}

这样输入wechatdemo.dotname.com的时候就不会受前面泛域名的影响。默认所有域名还是访问原来的系统。唯独小蝌蚪聊天室二级域名访问的是聊天室。这才是对用户友好的嘛 得意

注意:站点目录一定要配置到workerman-todpole/Applications/Todpole/Web





另外一种就是集成到自己系统,小蝌蚪即时聊天室项目的web目录(workerman-todpole/Applications/Todpole/Web)提取出来,放在外网能访问的目录,就可以跟没有端口的即时聊天系统愉快的玩耍了.

直接放进去是不能运行的,这个主要注意js/css的引用。










作者:陈永鹏

邮箱:chen.yong.peng@foxmail.com

零零糖网址导航

转载请注明作者陈永鹏CSDN博客地址:http://blog.csdn.net/chenyoper














  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪聊天室源码小蝌蚪
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值