Hello, I’m using a droplet to run a couple of static websites, each on their own domains, like:
mydomain.com
otherdomain.com
thirddomain.com
and so on.
Then, I use the same droplet to test other websites (mainly Wordpress sites), using subdomains this way:
website.mydomaincom
website2.otherdomain.com
...
For each of these I added an A record on the dns records management section in the DigitalOcean admin and then a nginx configuration file for each website like this one:
server {
root /var/www/website.com
index index.php index.html index.htm;
server_name website.mydomain.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/website.com$fastcgi_script_name;
fastcgi_param PHP_VALUE post_max_size=20M;
fastcgi_param PHP_VALUE upload_max_filesize=20M;
}
}
When trying to access the url website.domain.com I get an error 404. In the logs there’s this:
2019/02/10 18:26:47 [crit] 9914#9914: *30 connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 77.11.130.163, server: website.domain.com, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.2-fpm.sock:”, host: “website.domain.com” 2019/02/10 18:26:47 [error] 9914#9914: *30 open() “/usr/share/nginx/html/50x.html” failed (2: No such file or directory), client: 77.11.130.163, server: website.domain.com, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.2-fpm.sock”, host: “website.domain.com”
I’m not sure what to do. The thing is that till a couple of days ago this setup was actually working. What I did was upgrading the certbot. In doing so I might’ve broken something without realizing it.
Thanks for your help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi
It’s possible php-fpm isn’t started up. Try this. Locate the php-fpm service like this:
Then start it up:
Replace php7.2-fpm with the actual service name from the systemctl listing.
Cheers