If you looking for a way to redirect from www.mydns.com to mydns.com, you can use the following rewrite rules:

server {
server_name www.mydns.com;
rewrite ^(.*) http://mydns.com$1 permanent;
}
server {
root /var/www/mydns.com/;
index index.php index.html index.htm index.nginx-debian.html;
server_name www.mydns.com;

    location / {
            try_files $uri $uri/ =404;

    }
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }

    location ~ /\.ht {
            deny all;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *