nginx配置php访问和域名配置转发内网服务器
emer 发布于 2018-4-27 11:52 3857 次阅读
指的是当访问80端口时候,默认使用php指向本地路径,当访问指定域名时候转发到3000端口的node服务器上
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
root "F:/phpstudy/WWW";
location / {
index index.html index.htm index.php l.php;
autoindex off;
}
#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 "F:/php/WWW";
}
server {
listen 80;
listen 443 ssl spdy;
server_name lovelining.com;
ssl_certificate F:\phpstudy/nginx/ssl/1_lovelining.com_bundle.crt;
ssl_certificate_key F:/phpstudy/nginx/ssl/2_lovelining.com.key;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:3000;
}
}