How To Redirect www to Non-www with Nginx on Ubuntu 14.04

To redirect www to non-www using Nginx on Ubuntu 14.04, you can modify the server block configuration. Here’s a step-by-step guide:

  1. Open Nginx Configuration File

                        sudo nano /etc/nginx/sites-available/default

  2. Modify Server Block Configuration

    Find the server block that handles the domain. Within that block, add or modify the configuration to perform the redirection.

    For example:

                        server {
                            listen 80;
                            return 301 $scheme://$request_uri;
                        server {
                            listen 80;
                            # Other configuration directives for your domain
                            # ...

  3. Save and Close the File

    Save the changes and close the editor.

  4. Test Nginx Configuration

    Before applying changes, ensure that your Nginx configuration is error-free:

                        sudo nginx -t

  5. Restart Nginx

    If the test is successful, restart Nginx to apply the changes:

                        sudo service nginx restart

  6. Clear Browser Cache and Test

    Clear your browser cache or use a different browser to test the redirection by visiting It should automatically redirect to

Please replace with your actual domain name in the configurations provided above.

This setup will redirect any requests coming to to Adjust configurations according to your specific setup if you're using HTTPS or have additional server blocks or configurations for your domain

How To Open a Port on Linux

Opening a port on Linux involves configuring the firewall to allow traffic through the specified port. Here's a step-by-step guide to achieve this, assuming you are using ufw (Uncomplicated Firewall) or iptables for managing your firewall settings. u …

read more

Troubleshooting Latency Issues on App Platform

Troubleshooting latency issues on an app platform can be complex, involving multiple potential causes across the network, server, application code, and database. Here’s a structured approach to identifying and resolving latency issues. Identify …

read more