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

342
Visualizações
php and nginx on virtual private server configuration problem - ip works but not domain

I have a VPS setup that isn't working properly.

Environment: Ubuntu 18.04, php7.4, postgresql and nginx

The IP address for the server resolves successfully and shows default "Success" page served. The domain I want to use to point to the server does not work, however, and resolves 404. I feel like this is a simple fix but after a day of searching I haven't found it yet.

Help is appreciated!

Troubleshooting:

nslookup on windows resolves domain name to the correct IP address (I can ssh into server with just domain name)

the domain still remains not found when using the domain in my browser. Here is the /etc/nginx/sites-available/temp.domain:

    server {
        listen 80;

        server_name temp.domain;

        root /var/www/temp.domain/public_html;

        index index.php index.html;

        access_log /var/log/nginx/temp.domain.access.log;
        error_log /var/log/nginx/temp.domain.error.log;

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

        location ~ \.php {
            fastcgi_index index.php;
            fastcgi_pass unix:/usr/local/var/run/php-fpm.socket;

            include fastcgi_params;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    }

default config:

    server {
            listen 80 default_server;
            listen [::]:80 default_server;
     root /var/www/html;

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

            server_name 192.169.0.1; #temp ip address

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

            # pass PHP scripts to FastCGI server
            #
            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;
            }

            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            location ~ /\.ht {
                    deny all;
            }
    }

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

had to install php-config and then make sure php.ini has postgresql extensions enabled. Also had to fix the server block in nginx sites-available/default

over 4 years ago · Santiago Trujillo Relatório
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