gpanos
By:
gpanos

Nginx error 404 at maintainance page - mode Drupal 7

April 25, 2016 1.2k views
Nginx Drupal

Hello,
i am operating a digital ocean droplet with nginx 1.8.1 / drupal 7 site
when i updated from Nginx 1.4.6 i see maintenance page for my drupal site
not working .Returns 404 not found . So site is down.
At var/log/nginx i get this:

"/usr/share/nginx/html/50x.html" failed (2: No such file or directory), client: xx.xx.xxx.xx, server: www.example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "www.example.com"

i tried also this https://groups.drupal.org/node/256708#comment-824983
but with no luck.

Can you help?

Thanks
George

2 Answers

Could you paste here your nginx.conf? It seems like 50x error occurred, so nginx is trying to show you html page with 50x error, but could find the html file. Alternatively, check out Wodby on the Projects page, they provide a simple way to deploy Drupal to your droplets (they also use nginx).

Hello there, late answear but this is the configuration:

server {
listen 80;
server_name www.mysite.com;
rewrite ^/(.*) https://www.mysite.com/$1 permanent;
}

server {

listen 443 ssl;

root /var/www/html/drupal;
index index.php index.html index.htm;

servername www.mysite.com;
ssl
certificate /xxxxxxxx
sslcertificatekey /xxxxxxx

errorpage 404 = /index.html;
error
page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location = /favicon.ico {
lognotfound off;
access_log off;
}

location = /robots.txt {
allow all;
lognotfound off;
access_log off;
}

location ~ ../..php$ {
return 403;
}

location ~ ^/sites/.*/private/ {
return 403;
}

location ~ (^|/). {
return 403;
}

location / {
try_files $uri @rewrite;
}

location @rewrite {
rewrite ^ /index.php;
}

location ~ .php$ {
fastcgisplitpathinfo ^(.+.php)(/.+)$;
include fastcgi
params;
fastcgiparam SCRIPTFILENAME $requestfilename;
fastcgi
intercepterrors on;
fastcgi
pass unix:/var/run/php5-fpm.sock;

}

location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}

location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
lognotfound off;
}
}

Have another answer? Share your knowledge.