我使用默认端口80在Mydomain.com上安装了Nextcloud。我尝试设置Nginx,以便另一个运行它自己的网络服务器的应用程序获取所有请求转到Mydomain.com/ webapp /其他Web服务器在端口8080上侦听的同一服务器上运行。
基本上,我如何配置Nginx来重定向所有要转发到Mydomain.com/webapp/*的请求,而不是由127.0.0.1:8080处理?
这是我目前在netsx中破解的https / ssl服务器块:/etc/nginx/conf.d/mydomain.com/mydomain.com.conf:
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mydomain.com;
ssl_certificate /etc/ssl/certs/mydomain.com/crt.pem;
ssl_certificate_key /etc/ssl/certs/mydomain.com/key.pem;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!eNULL:!LOW:!EXP:!RC4:!3DES:+HIGH:+MEDIUM;
add_header Strict-Transport-Security "max-age=31536000;";
location /webapp {
rewrite /webapp(.*) $1 break;
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
include conf.d/mydomain.com.d/*.conf;
access_log /var/log/nginx/mydomain.com-access.log;
error_log /var/log/nginx/mydomain.com-error.log;
}
谢谢,来自这里的第一个计时器!