Are you deploying a Laravel application or something else? By default nginx in pointing to the public directory of your project. If you don't have a public directory nginx can't resolve and it will fail.
May 7, 2019
11
Level 9
Forge Provisioned DigitalOcean Nginx 404 not found
I used forge to provision a server on Digital Ocean and when i visit the IP i get 404 Not Found. i can ping the IP and also i can ssh into the server. i have even deleted the site and re added it but same result.
how can i get nginx to serve my site
nginx -t output is
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
nginx config
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/emopgh.org/before/*;
server {
listen 80;
listen [::]:80;
server_name emopgh.org;
root /home/forge/emopgh.org/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/emopgh.org/server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/emopgh.org-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/emopgh.org/after/*;
nginx status is
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2019-05-07 14:57:59 UTC; 22min ago
Docs: man:nginx(8)
Process: 27662 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, s
Process: 28592 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
Process: 27674 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 27663 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 27678 (nginx)
Tasks: 2 (limit: 2362)
CGroup: /system.slice/nginx.service
├─27678 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─28593 nginx: worker process
May 07 14:57:58 emop-server systemd[1]: Stopped A high performance web server and a reverse proxy server.
May 07 14:57:58 emop-server systemd[1]: Starting A high performance web server and a reverse proxy server...
May 07 14:57:58 emop-server systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
May 07 14:57:59 emop-server systemd[1]: Started A high performance web server and a reverse proxy server.
May 07 14:57:59 emop-server systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 07 14:57:59 emop-server systemd[1]: Reloaded A high performance web server and a reverse proxy server.
May 07 14:58:17 emop-server systemd[1]: Reloading A high performance web server and a reverse proxy server.
May 07 14:58:17 emop-server systemd[1]: Reloaded A high performance web server and a reverse proxy server.
thanks in advance
Please or to participate in this conversation.