为了能快速了解并处理您的问题,请提供以下基础信息: 下面是我宝塔的配置文件
server
{
listen 80;
listen 443 ssl;
server_name fx.889961.xyz fg.889961.xyz;
index index.php index.html index.htm default.php default.htm default.html;
root d:/baota/wwwroot/fx_api;
#START-ERROR-PAGE
#error_page 403 /403.html;
error_page 404 /404.html;
#error_page 502 /502.html;
#END-ERROR-PAGE
#HTTP_TO_HTTPS_START
#HTTP_TO_HTTPS_END
#LIMIT_INFO_START
#LIMIT_INFO_END
#SSL-INFO-START
ssl_certificate ssl/fx.889961.xyz/fullchain.pem;
ssl_certificate_key ssl/fx.889961.xyz/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-INFO-END
#反代清理缓存配置
location ~ /purge(/.*) {
proxy_cache_purge cache_one $1$is_args$args;
}
#proxy 反向代理
include proxy/fx.889961.xyz/*.conf;
#PHP-INFO-START
include php/72.conf;
#PHP-INFO-END
#REWRITE-START
include rewrite/fx.889961.xyz/*.conf;
#REWRITE-END
#redirect 重定向
include redirect/fx.889961.xyz/*.conf;
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
access_log D:/BaoTa/BtSoft/wwwlogs/fx.889961.xyz.log;
error_log D:/BaoTa/BtSoft/wwwlogs/fx.889961.xyz.error.log;
}
下面是我宝塔的反向代理配置文件应该是include proxy/fx.889961.xyz/*.conf;这个文件吧
location /
{
if ($request_uri ~* "(php|jsp|cgi|asp|aspx)")
{
expires 0;
}
proxy_pass http://127.0.0.1:9090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
proxy_set_header Accept-Encoding "";
sub_filter_once off;
#proxy_cache cache_one;
#proxy_cache_key $host$uri$is_args$args;
#proxy_cache_valid 200 304 301 302 12h;
}
我的问题是
我有一个后端程序绑定监听9090的端口,本来没有使用Nginx反向代理的时候外部我是可以通过ip:9090的方式访问,并且安全组和防火墙都是开放的。然后我的域名通过Nginx反向代理到了9090端口,这时候我只能通过Nginx反向代理的域名访问到9090,而ip:9090的方式就不可以了。
请问怎么修改配置才可以域名也能访问,ip+端口的方式也能访问
而且我两个网站,都配置反向代理的时候最后配置的那个保存的时候就会错误,提示我两个location /块冲突
|
|