Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 714 Bytes

nginx.md

File metadata and controls

33 lines (25 loc) · 714 Bytes

nginx Configurations

Remove the default nginx homepage

Source

sudo rm /etc/nginx/sites-enabled/default

Redirect HTTP traffic to HTTPS

Source

Add the following to /etc/nginx/sites-available/mysite.com

server {
    listen 80 default_server;

    server_name _;

    return 301 https://$host$request_uri;
}

Redirect from a subdirectory to root

Source

Add the following inside of a server block in /etc/nginx/sites-available/mysite.com

# redirects all traffic on /dashboard back to root /
location = /dashboard {
    return 301 /;
}