Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

343
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda