I have tried to set up a LEMP server (Nginx, PHP, MySQL) on Arch Linux for a while, and have tried a few different online tutorials.
Most recently I tried: http://www.adminempire.com/how-to-insta … mysql-php/.
This tut asks me to create a seperate php.conf file in /etc/nginx/ and add:
location ~ \.(php|html|htm)$ {
try_files $uri = 404;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
then add to /etc/nginx/nginx.conf, iside the server class : include php.copf;
first I goto http://localhost
, to test to make sure Nginx is running, and then I test http://localhost/phpinfo.php
and I get a 404 error, I have restrted nginx (with no errors), and restarted php-fpm ( I even restarted my system). still getting the 404.
The tutorial said to put a phpinfo.php file /srv/http/phpinfo.php, but upon looking at nginx.conf I see:
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
So I tried in /usr/share/nginx/html/phpinfo.php, and still get a 404
Best Answer
In your
/srv/http
directory, create aphpinfo.php
file which containsThen modify your
/etc/nginx/nginx.conf
fileFinally, restart
nginx
andphp-fpm
and try the following urlhttp://localhost/phpinfo.php
And it should work!