Mobile app version of vmapp.org
Login or Join
Sarah324

: Nginx aliases and proxy_pass I'm using nginx as web front-end and apache2 as web back-end. Apache runs several websites locally and nginx access them. At the moment, different sub-domains are

@Sarah324

Posted in: #Configuration #Nginx #WebHosting

I'm using nginx as web front-end and apache2 as web back-end. Apache runs several websites locally and nginx access them.

At the moment, different sub-domains are hosted, but I want to migrate them into a single one using my-single-domain.com/subdomain-alias thanks to nginx.

The root directory and the apache2 vhost port is different for each sub-domain (sounds obvious, doesn't it?).

I tried several configurations but I cannot get the resource being sent, i.e., the index html is sent but the resources are not found by the server (404 Not Found) despite the rule root being set.

I tried several solution such as:

location /alias1 {
proxy_pass 127.0.0.1:9095/; include /etc/nginx/proxy.conf;
}


or

location /alias1 {
alias /alias1/;
proxy_pass 127.0.0.1:9095/; include /etc/nginx/proxy.conf;
}


or even

location /alias1/ {
rewrite ^/alias1(/.*)$ break;
proxy_pass 127.0.0.1:9095/; }


or again

location /alias1/ {
rewrite ^/alias1(/.*)$ break;
proxy_pass 127.0.0.1:9095/; proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}


What is wrong with this setup?

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Sarah324

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme