一人在行走

35050-一人在行走

http://www.dy360.net,一个有逼格的电影小站

  • 财富值

    250

  • 威望值

    0

  • 总积分

    420

个人信息

  • 收藏了话题
    2016-12-20 14:48
  • 2016-12-20 已签到
    连续签到1天,获得了5个金钱
    2016-12-20 14:32
  • 2016-12-09 已签到
    连续签到1天,获得了5个金钱
    2016-12-09 16:41
  • 赞了回答

    backend和frontend分开配置,可以配置不同端口,比如一个用listen 8000,一个listen 8080,也可以配置不同域名,比如一个server_name www.backend.com,一个server_name www.frontend.com,生产环境中如果需要用到不同子域名,只需要配置不同的server_name,可以都使用80端口。具体例子如下(使用php-fpm):

    #backend配置
    server {
        charset utf-8;
        client_max_body_size 128M;
    
        listen 8000; ## listen for ipv4
        #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
    
        server_name www.backend.com;
        root        /var/www/yii-test/backend/web;
        index       index.php;
    
    
        access_log  /var/www/yii-test/access.backend.log main;
        error_log   /var/www/yii-test/error.backend.log;
    
        location / {
            # Redirect everything that isn't a real file to index.php
            try_files $uri $uri/ /index.php?$args;
        }        
    
        location ~ \.php$ {
            include fastcgi.conf;
            fastcgi_pass   127.0.0.1:9000;
            #fastcgi_pass unix:/var/run/php5-fpm.sock;
            try_files $uri =404;
        }
        
        error_page 404 /404.html;
    
        location ~ /\.(ht|svn|git) {
            deny all;
        }
    }
    
    #frontend配置
    server {
        charset utf-8;
        client_max_body_size 128M;
    
        listen 8080; ## listen for ipv4
        #listen [::]:80 default_server ipv6only=on; ## listen for ipv6
    
        server_name www.frontend.com;
        root        /var/www/yii-test/backend/web;
        index       index.php;
    
    
        access_log  /var/www/yii-test/access.frontend.log main;
        error_log   /var/www/yii-test/error.frontend.log;
    
        location / {
            # Redirect everything that isn't a real file to index.php
            try_files $uri $uri/ /index.php?$args;
        }        
    
        location ~ \.php$ {
            include fastcgi.conf;
            fastcgi_pass   127.0.0.1:9000;
            #fastcgi_pass unix:/var/run/php5-fpm.sock;
            try_files $uri =404;
        }
        
        error_page 404 /404.html;
    
        location ~ /\.(ht|svn|git) {
            deny all;
        }
    }
    
    2016-12-03 21:35查看
  • 2016-11-16 已签到
    连续签到1天,获得了5个金钱
    2016-11-16 12:27

见习主管 查看等级规则 | 排行榜

420/50084% Complete
420/50084% Complete
420/50084% Complete

Ta的关注 1

所有关注»

Ta的粉丝 5

所有粉丝»

最近访客

所有访客»
在线
656