Monday 5 March 2018

nginx configuration

server {
        listen 80;
        server_name nuclearcarrot.co.uk www.nuclearcarrot.co.uk;
        server_name_in_redirect off;
        root /srv/www/nuclearcarrot.com/nuclearcarrot/;
        access_log /srv/www/nuclearcarrot.com/logs/access.log;
        error_log /srv/www/nuclearcarrot.com/logs/error.log;
        rewrite  ^/$  /andyboot.html  permanent;
        rewrite ^/favicon.ico$ /img/favicon.ico last;
 
        # Dont expose hidden files to the web
        location ~ /\. {
                return 404;
        } 
I want to talk about my old nginx config file.
  • server_name = What urls it should listen to
  • root = where to serve static files from
  • rewrite = These are interesting - if a client asks for X we redirect them to Y instead. - Here it was used in a desperate attempt to get more SEO juice by redirecting / to my name.

No comments:

Post a Comment