我以前从未使用过 Nginx,现在负责将其配置为生产局域网中某个网站的反向代理。我的端口 80 可以正常工作,但我还需要端口 443 和端口 18081 才能与同一 Web 服务器配合使用。Nginx 服务器是 Windows 2012 服务器,运行 Mginx 1.17.9。我知道这个配置很乱,因为我拿了一个应该适用于多个端口的配置,并标注了我认为在我的情形下不需要的配置。任何帮助都将不胜感激,使它能够将所有 3 个端口代理到内部服务器。外部用户将使用的 URL 是https://website.domain.com/mydealer/#/login/QS36F
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http{
server{
listen 80;
server_name website.domain.com;
location / {
proxy_pass http://1.2.3.4/;
#proxy_redirect off;
#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;
#proxy_set_header X-Nginx-Proxy true;
#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 html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
listen 18081;
# listen somename:8080;
server_name website.domain.com;
location / {
proxy_pass http://1.2.3.4/;
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
listen 443;
server_name website.domain.com;
location / {
proxy_pass https://1.2.3.4/;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
}
答案1
如果我理解正确的话,您想在 Windows 2012 服务器上部署 nginx 反向代理。
您的 apache web 服务器在哪里运行?与 nginx 在同一台机器上还是在其他机器上?您有多少个 apache web 服务器?
请说得更具体一些!
关于鲍里斯