Domain redirection problem in nginx

When I am opening this in browser it redirecting to this (Check this screen short: , I am using cloudflare. this domain( is added in cloudflare account.

THis is my domain configuration.

# Redirect_Host
server {
    listen 80;

    return 301$request_uri;
# Main_Host
server {
    listen 80;
    listen [::]:80;
    index index.php index.htm index.html;

    # root Directory
    root /srv/users/kwikservers/;
    # Wordpress - Handle PHP
    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    # Handle PHP with Fast CGI
    location ~ \.php$
        include /etc/nginx/snippets/fastcgi-php.conf;
        fastcgi_param   HTTP_PROXY      "";
    # Logs
    access_log /srv/users/kwikservers/; 
    error_log /srv/users/kwikservers/; 
    # Website Config
    include /etc/nginx/sites-available/*.conf;

Can you help me pls. What’s doing wrong? Thanks in advance

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

The Nginx configuration looks correct.

Is the other website also hosted on the same server?

I could suggest a few things:

  • Make sure that there are no references for the other domain name in your database, for example, if you are using WordPress, make sure that the site and home URLs are set correctly.

  • Make sure that your has an active SSL so that in case anyone tries to access the site over HTTPS it would load as normal rather than being redirected to the first site with SSL certificate on the same server

Regards, Bobby