server { server_name localhost; listen 80; autoindex on; set $charset utf-8; charset $charset; set $rootdir /www; root $rootdir; index index.php index.html; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # With php5-cgi alone: fastcgi_pass web-php:9000; # With php5-fpm: #fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $rootdir/$fastcgi_script_name; include fastcgi_params; } } server { server_name wx.shemic.com; listen 80; # 或者 443,如果你使用 HTTPS 的话 # ssl on; 是否启用加密连接 # 如果你使用 HTTPS,还需要填写 ssl_certificate 和 ssl_certificate_key location / { # 如果你希望通过子路径访问,此处修改为子路径,注意以 / 开头并以 / 结束 proxy_pass http://wx.shemic.com:5000/; } }