Created
March 8, 2018 06:12
-
-
Save flionic/c1082243b58ed42abfe2018f8aeac835 to your computer and use it in GitHub Desktop.
Nginx config for Ajenti 2.1.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name YOU-SERVER-NAME; | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/YOU-SERVER-NAME/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/YOU-SERVER-NAME/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
client_max_body_size 20m; | |
location / { | |
rewrite (/ajenti)$ / break; | |
rewrite /ajenti/(.*) /$1 break; | |
proxy_pass http://127.0.0.1:8000; | |
proxy_redirect / /ajenti/; | |
proxy_set_header Host $host; | |
proxy_set_header Origin http://$host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $http_connection; | |
} | |
} | |
server { | |
listen 80; | |
server_name YOU-SERVER-NAME; | |
if ($host = YOU-SERVER-NAME) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
return 404; # managed by Certbot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is my configurations, I don't think the extra line is necessary. Removing
proxy_redirect / /ajenti/;
will help eliminate the ugly URL https://yourdomain.tld/view/login/normal//ajenti/view/login/normal