Nginx and PHP-FastCGI on Ubuntu 12.04 LTS

I'm trying to get Nginx and PHP-FastCGI on Ubuntu 12.04 LTS configured correctly, but running into problems. Any help is appreciated. I will provide any additional information if needed.

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/www.conf and /etc/nginx/sites-available/gogogainesville.com changing the "listen =" and "fastcgi_pass" parameters, respectively. The parameters I've tried are:

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

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.

@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: http://www.pcwebplus.nl/phpbb/viewtopic … 72&t=10320">http://www.pcwebplus.nl/phpbb/viewtopic.php?f=272&t=10320

Google translate should work for it, just keep the dutch version for commands/code block references.

Good luck

I've a stack script that sets up a LEMP stack. https://www.linode.com/stackscripts/vie … iptID=4745">https://www.linode.com/stackscripts/view/?StackScriptID=4745 it could do with an update but it should still work fine.

Have you checked that you have a symbolic link to /sites-enabled/* ?

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.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct