系统1对应域名dev.xxx.com:8080

系统2对应域名blog.xxx.com:8080

  • nginx.conf
    user  www www;
    worker_processes 5;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        #gzip  on;
        client_max_body_size 500M;
    
    include vhost/*.conf;
    
    }
    
  • phabricator.conf
    server {
    
      listen        8080;
      server_name   dev.moukesoft.com;
      root          /usr/local/phabricator/webroot;
      try_files $uri $uri/ /index.php;
      location / {
        index   index.php;
    
        if ( !-f $request_filename )
        {
          rewrite ^/(.*)$ /index.php?__path__=/$1 last;
          break;
        }
      }
    
      location /index.php {
        fastcgi_pass   localhost:9000;
        fastcgi_index   index.php;
    
        #required if PHP was built with --enable-force-cgi-redirect
        fastcgi_param  REDIRECT_STATUS    200;
    
        #variables to make the $_SERVER populate in PHP
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;
    
        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
    
        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
    
        fastcgi_param  REMOTE_ADDR        $remote_addr;
      }
    }
    
  • blog.conf
    server {
            listen       8080;
            server_name  blog.kael.wang;
            root         /home/wwwroot/gitblog;
            index        index.html index.htm index.php;
    
            location ~ \.(jpg|png|gif|js|css|swf|flv|ico)$ {
                     expires 12h;
            }
    
            location / {
                    if (!-e $request_filename) {
                        rewrite ^(.*)$ /index.php?$1 last ;
                        break;
                    }
            }
    
            location ~* ^/(doc|logs|app|sys)/ {
                    return 403;
            }
    
            location ~ .*\.(php|php5)?$
            {
                    fastcgi_connect_timeout 300;
                    fastcgi_send_timeout 300;
                    fastcgi_read_timeout 300;
                    fastcgi_pass   127.0.0.1:9000;
                    fastcgi_index  index.php;
                    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include        fastcgi_params;
            }
    }
    

特别注意

listen 中指定了端口8080,在server_name 中,只需要写入三级域名信息,不需要再跟端口号!否则多域名解析无效!


0 条评论

发表回复

Avatar placeholder

您的邮箱地址不会被公开。 必填项已用 * 标注