Nginx and PHP-FastCGI on Ubuntu 12.04 LTS
I have two nginx configuration files at:
/etc/nginx/nginx.conf
/etc/nginx/sites-available/mysite.com
Issue 1: mysite.com/info.php "File not found."
I've created a doc named info.php in /usr/share/nginx/html. When I attempt to visit the file, I get "File not found." as my error message. I see no place in my configuration files where /usr/share/nginx/html is specified…should that be set as root somewhere? My websites files are in /srv/www/mysite.com/public_html which is set as the root in /etc/nginx/sites-available/mysite.com
Issue 2: mysite.com/importbuddy.php "Error #224834. This directory is not write enabled. Please verify write permissions to continue."
I have a doc named importbuddy.php to import a wordpress website in /srv/www/mysite.com/public_html. I believe the error message I receive when I try to visit this site is due to my php-fpm/php-fcgi server not having write permissions in this directory, but I'm not sure how to enable write permissions for the php-fpm/php-fcgi server.
Additional information:
I have gone back and forth in /etc/php5/fpm/pool.d/
listen = 127.0.0.1:9000;
listen = /var/run/php5-fpm.sock;
listen = /tmp/php5-fpm.sock;
listen = /var/run/php-fastcgi/php-fastcgi.socket;
In the last case, I created an executable file /usr/bin/php-fastcgi with the following contents (where 'my_user' is the user who owns /srv/www/*):
File:/usr/bin/php-fastcgi
!/bin/bash
FASTCGIUSER=myuser
FASTCGIGROUP=myuser
SOCKET=/var/run/php-fastcgi/php-fastcgi.socket
PIDFILE=/var/run/php-fastcgi/php-fastcgi.pid
CHILDREN=6
PHP5=/usr/bin/php5-cgi
/usr/bin/spawn-fcgi -s $SOCKET -P $PIDFILE -C $CHILDREN -u $FASTCGIUSER -g $FASTCGIGROUP -f $PHP5
I've installed the following:
spawn-fcgi
php5-cli
php5-cgi
php5-fpm
psmisc
If anyone can shed some light on my config. issues or point me in a good direction, I'd really appreciate it.
4 Replies
@Tantrik:
I unfortunately had VERY similar if not exactly the same problems setting this same combo up. 2 Weeks into owning a Linode I called it impossible as of now and switched to apache unfortunately. Would love to hear a fix on this one.
Impossible? :/ There's plenty of guides available on setting this up.
Now I don't use spawn-fcgi (I use PHP-FPM/FastCGI)and I do it with Debian and nginx - I have a Dutch guide here:
Google translate should work for it, just keep the dutch version for commands/code block references.
Good luck
Remember that Nginx only listens to sites-enabled, and you'll need to create a symbolic link between your mysite.com conf file in sites-available to a similar one in sites-enabled.