Hello everybody,
First, sorry for mi English because I'm French.
I have a litle problem that I can't fix.
I have a web server in my lan accessible with https://lanserver url.
I have a domain name called toto.com that points to my nginx.
When I use https://toto.com in my browser, I have the same page that https://lanserver, so my nginx reverse proxy here works fine!
However, when I use https://toto.com/test.lol I'm not go to the same location that https://lanserver/test.lol, I have the following error:
=========
Erreur du serveur dans l'application '/'.
La ressource est introuvable.
Description : HTTP 404. La ressource recherchée (ou l'une de ses dépendances) a peut-être été supprimée ou renommée ou bien elle n'est plus disponible temporairement. Vérifiez l'URL ci-après et assurez-vous qu'elle est correcte.
URL demandée: /test.lol
Informations sur la version : Version Microsoft .NET Framework :2.0.50727.4211; Version ASP.NET :2.0.50727.4209
=========
In english somethink like that :
=========
Server error in "/" application.
Resource not found.
Description: HTTP 404. The searched resource (or one of its dependencies) may have been deleted or renamed, or it is no longer available temporarily. Check the URL below and make sure it is correct.
URL requested: /test.lol
Version information : Version Microsoft .NET Framework :2.0.50727.4211; Version ASP.NET :2.0.50727.4209
=========
My nginx configuration :
- upstream_toto.com.conf file :
=========
upstream backend_toto.com {
least_conn;
server lanserver:80 weight=5 max_fails=1 fail_timeout=10s;
}
=========
- toto.com.conf file :
=========
server {
listen 443 ssl;
server_name toto.com;
ssl_certificate /etc/nginx/ssl/coucou.info/coucou.info.crt;
ssl_certificate_key /etc/nginx/ssl/coucou.info/coucou.info.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ssl_verify_client off;
# gestion des logs
access_log /var/log/nginx/toto.com_access.log;
error_log /var/log/nginx/toto.com_error.log;
# Deny all for .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
allow xxx.xxx.xxx.xxx;
deny all;
proxy_pass http://backend_toto.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
=========
I have already tried a lot of things found on the net but all unsuccessful, I hope to be able to find here my answer!
How to route a path in nginx ?
Thank you for your help :)
First, sorry for mi English because I'm French.
I have a litle problem that I can't fix.
I have a web server in my lan accessible with https://lanserver url.
I have a domain name called toto.com that points to my nginx.
When I use https://toto.com in my browser, I have the same page that https://lanserver, so my nginx reverse proxy here works fine!
However, when I use https://toto.com/test.lol I'm not go to the same location that https://lanserver/test.lol, I have the following error:
=========
Erreur du serveur dans l'application '/'.
La ressource est introuvable.
Description : HTTP 404. La ressource recherchée (ou l'une de ses dépendances) a peut-être été supprimée ou renommée ou bien elle n'est plus disponible temporairement. Vérifiez l'URL ci-après et assurez-vous qu'elle est correcte.
URL demandée: /test.lol
Informations sur la version : Version Microsoft .NET Framework :2.0.50727.4211; Version ASP.NET :2.0.50727.4209
=========
In english somethink like that :
=========
Server error in "/" application.
Resource not found.
Description: HTTP 404. The searched resource (or one of its dependencies) may have been deleted or renamed, or it is no longer available temporarily. Check the URL below and make sure it is correct.
URL requested: /test.lol
Version information : Version Microsoft .NET Framework :2.0.50727.4211; Version ASP.NET :2.0.50727.4209
=========
My nginx configuration :
- upstream_toto.com.conf file :
=========
upstream backend_toto.com {
least_conn;
server lanserver:80 weight=5 max_fails=1 fail_timeout=10s;
}
=========
- toto.com.conf file :
=========
server {
listen 443 ssl;
server_name toto.com;
ssl_certificate /etc/nginx/ssl/coucou.info/coucou.info.crt;
ssl_certificate_key /etc/nginx/ssl/coucou.info/coucou.info.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ssl_verify_client off;
# gestion des logs
access_log /var/log/nginx/toto.com_access.log;
error_log /var/log/nginx/toto.com_error.log;
# Deny all for .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / {
allow xxx.xxx.xxx.xxx;
deny all;
proxy_pass http://backend_toto.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
=========
I have already tried a lot of things found on the net but all unsuccessful, I hope to be able to find here my answer!
How to route a path in nginx ?
Thank you for your help :)