Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

226
Visualizações
Nginx redirects to the same page recurtsivly

I have made a website with one subdomain hosted on a local Raspberry Pi on Nginx in my house network.

I can access the subdomain on say : sub.mydomain.com

But when I try and access the main site : domain.com

I get redirected to :

domain.com/domain.com/domain.com/domain.com/domain.com/domain.com/domain.comdomain.comdomain.comdomain.comdomain.com/ ( and so on )

Here is my setup :

I am running this locally, so I am trying to see my own website so I am using a VPN which works for the subdomain but not the main page.

If I use domain.com/index.html that works but it will not go from domain.com to domain.com/index.html automatically. ( it did this the last time I made a single - non subdomain - webpage site )

If I access this from my phone ( external network ) it all works great.

I would like to know why this is happening and how to fix it as the WordPress site cant be seen from me inside my network now.

Here is my Nginx config for domain.com :

server {

        root /var/www/doamin.com;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

        server_name doamin.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        location /custom/ {
                proxy_pass http://localhost:1234;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/doamin.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/doamin.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}



server {
    if ($host = doamin.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

        listen 80 default_server;
        listen [::]:80 default_server;

        server_name doamin.com;
    return 404; # managed by Certbot

}

If possible please explain why it does this in as simple terms as possible , I would like to understand this better, networking and server setup like this is very new to me.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda