nginx Reverse Proxy
nginx Reverse Proxy
Hi,
I am attempting to move my dev site into a fresh install of vestacp. The frontend of my website is a wordpress blog, and the webapp side is written as a nodejs app. In my previous environment (without vestacp), I was easily able to set up the following configurations in nginx.conf:
I have tried to replicate the configuration within vestacp's advanced configuration area. However, when I navigate to http://mydomain.com/app I get a simple Wordpress 404 error.
Is there something obvious I'm doing wrong? Or is there a better way to go about doing this?
I am attempting to move my dev site into a fresh install of vestacp. The frontend of my website is a wordpress blog, and the webapp side is written as a nodejs app. In my previous environment (without vestacp), I was easily able to set up the following configurations in nginx.conf:
Code: Select all
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mydomain.com;
root /usr/share/nginx/html;
expires $expires;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
# Security Implementations for node...
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
# add_header Content-Security-Policy "default-src 'self' style-src 'self' 'unsafe-inline'";
# Hide "powered by" line in headers. So people can't see what software we're running to serve page content
proxy_hide_header X-Powered-By;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Hide version numbers in error messages and headers
server_tokens off;
location /app {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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;
}
location /dev {
proxy_pass http://localhost:6000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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;
}
location /dl {
alias /usr/share/nginx/html/dl;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
Is there something obvious I'm doing wrong? Or is there a better way to go about doing this?
Re: nginx Reverse Proxy
nginx error logs don't say anything?
or you can try something like
or
or you can try something like
Code: Select all
location /dev/
Code: Select all
location ^~ /dev/
Re: nginx Reverse Proxy
hi,
can you post your solution?
can you post your solution?