加入收藏 | 设为首页 | 会员中心 | 我要投稿 广州站长网 (https://www.020zz.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php nginx 域名重定向,nginx域名重定向遇到的问题

发布时间:2023-01-30 16:31:14 所属栏目:PHP教程 来源:未知
导读: 应客户要求,需要给客户配个域名php重定向,然后我们的大牛强哥 建议后台不要配备域名服务器了,这样不安全,一般都是对外的web服务器才配置域名;
结合另外收藏的一个博文安装nginx,然后修

应客户要求,需要给客户配个域名php重定向,然后我们的大牛强哥 建议后台不要配备域名服务器了,这样不安全,一般都是对外的web服务器才配置域名;

结合另外收藏的一个博文安装nginx,然后修改配置文件如下:

server {

listen 80; ——————————固定端口80

server_name A B; ——————逗号间隔一级域名、二级域名

location / {

root /alidata1/tomcat-tes/……;————————服务器绝对路径 根目录

index index.html index.htm index.jsp;

proxy_send_timeout 1200;

proxy_connect_timeout 1200;

proxy_pass *.216*;——————————要比对的地址

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;

}

location /share {————————服务器业务模块二级路径

index index.html index.htm index.jsp;

proxy_send_timeout 1200;

proxy_connect_timeout 1200;

proxy_pass *;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;

}

location /chao {

index index.html index.htm index.jsp;

proxy_send_timeout 1200;

proxy_connect_timeout 1200;

proxy_pass */;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;

}

}

修改完了之后要重启nginx 命令, service nginx restart

如果有必要还重启一下tomcat,

初识nginx

以上就介绍了nginx域名重定向遇到的问题,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

(编辑:广州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!