By Demos Petsas
I am getting the same error when trying to load the info.php file and have been trying to solve it for hours but can’t seem to find a solution.
I installed LEMP with 16.04 but it seems hard to find why my php is not working.
My nginx sites-available file looks like this:
server { listen 80; listen [::]:80;
server_name website.com www.website.com;
location / {
root /var/www/website.com/html;
index index.html index.htm index.php index.nginx-debian.html;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
server { listen 443; ssl on; # ssl_certificate ssl_certificate /etc/nginx/cert_chain.crt; # ssl_certificate_key ssl_certificate_key /root/website.com.key;
server_name website.com website.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
root /var/www/website.com/html;
index index.php index.html index.htm index.nginx-debian.html;
}
location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; }
location ~ /\.ht {
deny all;
}
}
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!
You need first to enable this site by creating a symbolic link for this site in sites-enabled directory
use this command to achieve this:
sudo ln -s /etc/nginx/sites-available/<sitename> /etc/nginx/sites-enabled/<sitename>
then restart nginx: sudo service nginx restart
Hope this helps
This comment has been deleted
I found and resolved the issue, I moved ``` root /var/www/website.com/html; index index.html index.htm index.php index.nginx-debian.html;
server { listen 80; listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.php index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
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;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
server {
listen 443;
ssl on;
# ssl_certificate
ssl_certificate /etc/nginx/cert_chain.crt;
# ssl_certificate_key
ssl_certificate_key /root/example.com.key;
root /var/www/example.com/html;
index index.html index.htm index.php index.nginx-debian.html;
server_name example.com www.example.com;
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location / {
try_files $uri $uri/ =404;
}
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;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.