前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >一个实用的nginx配置

一个实用的nginx配置

作者头像
用户5640963
发布2019-07-26 10:31:21
3190
发布2019-07-26 10:31:21
举报
文章被收录于专栏:卯金刀GG

记录一下内容,以备查阅!

注:转发的时候,是以包的名字区分的。

1、httpd.conf server { listen 8081; server_name localhost;

#charset koi8-r;

access_log /home/log/localhost.access.log ; error_log /home/log/localhost.error.log ;

location ~ ^/guahao{ proxy_set_header Host guahao.z.com; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:81; } location ~ ^/hos{ proxy_set_header Host hos.guahao.z.com; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:81; } location ~ ^/admin{ proxy_set_header Host ghadmin.z.com; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:81; } location ~ ^/item{ proxy_pass http://127.0.0.1:8090; } # location ~ !^/(guahao|hos|admin){ # proxy_pass http://127.0.0.1:8082; # } }

2、guahao.z.com.conf

server { listen 81; root /**/**/**/guahao.z.com/web/; server_name guahao.z.com; default_type 'text/html'; #charset GBK;

access_log /home/log/guahao.z.com.access.log ; error_log /home/log/guahao.z.com.error.log ;

location / { index index.html index.htm index.php; }

#error_page 404 /404.html; rewrite ^/guahao/(.*) /$1 last;

location ~ .*\.php { fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

}

3、hos.guahao.z.com.conf

server { listen 81; root /**/**/**/hos.guahao.z.com/; server_name hos.guahao.z.com; default_type 'text/html'; #charset GBK;

access_log /home/log/hos.guahao.z.com.access.log ; error_log /home/log/hos.guahao.z.com.error.log ;

location / { index index.html index.htm index.php; }

#error_page 404 /404.html; rewrite ^/hos/(.*) /$1 last; location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

}

4、ghadmin.z.com.conf

server { listen 81; root /**/**/**/ghadmin.z.com/admin/; server_name ghadmin.z.com; default_type 'text/html'; #charset GBK;

access_log /home/log/ghadmin.z.com.access.log ; error_log /home/log/ghadmin.z.com.error.log ;

location / { index index.html index.htm index.php; }

#error_page 404 /404.html; rewrite ^/admin/(.*) /$1 last; location ~ \.php { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; }

}

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档