Setting up a domain

cd /etc/nginx/conf.d/vhosts

sudo nano X.com.conf

ADD: return 301 https://www.X.X$request_uri; (save)

I.e.

server {

    listen 176.31.193.41:80;

    access_log /var/log/nginx/access.yoursite.site.log;

    error_log /var/log/nginx/error.yoursite.site.log;

    server_name yoursite.site www.yoursite.site;

    root /public_html/yoursite.site;

    return 301 https://www.yoursite.site$request_uri;


sudo nano X.X_ssl; ADD: if ($host !~ ^www\.) {             rewrite ^ https://www.$host$request_uri permanent;          } I.e.  server {     listen 176.31.193.41:443;    access_log /var/log/nginx/access.yoursite.site.log;    error_log /var/log/nginx/error.yoursite.site.log;    server_name yoursite.site www.yoursite.site;    root /home/sage/public_html/yoursite.site;     if ($host !~ ^www\.) {         rewrite ^ https://www.$host$request_uri permanent;     }     ssl                  on;  
All Tags


Leave a Reply

%d bloggers like this: