I am big fan of Debian.
It just easy to setup a nice clean server get the job done.
For more effective web server, I try to use Nginx + PHP5-FPM to serve Wordpress and Mediawiki.
I bring up a new Debian Wheezy 7.5 64-bit server today.
1.First upgrade all new patch:aptitude update && aptitude upgrade
2.Install Nginx Stable follow Nginx's offical Pre-Built Packages:http://nginx.org/en/linux_packages.html#stable
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
aptitude update
aptitude install nginx
3.Install Latest MariaDB Pre-Built Packages:aptitude install python-software-properties
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/debian wheezy main'
aptitude install mariadb-server
4.Install PHP5-FPM:aptitude install php5-fpm
5.Modify Nginx vhost location in /etc/nginx/nginx.conf:include /etc/nginx/sites-enabled/*.conf;
6.Put my vhost file at /etc/nginx/sites-available/mds.conf:server {
listen 80;
server_name localhost;
access_log /var/log/nginx/log/mds.access.log main;
error_log /var/log/nginx/log/mds.error.log error;
root /var/www/mds;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/mds;
}
# With php5-fpm / php5-cgi will be different:
location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Make a link:
ln -s /etc/nginx/sites-available/mds.conf /etc/nginx/sites-enable/
Restart Nginx:
service nginx restart
Then I put a index.php with phpinfo() into the /var/www/mds folder.
But the browser shows blank page.
I try follow different post, able to bring errors logs: php5-fpm.sock failed (13: Permission denied) error
But still not able to quickly fix it.
Spend almost half hour on it, finally found:
Missing this line in /etc/nginx/fastcgi_params:fastcgi_param SCRIPT_FILENAME $request_filename;
I should just stay with Debian Nginx 1.2, what a wast!
Nginx's RPM package works just fine.
Hope this helps.
Update 1 on June 24, 2014:It seems more problem are coming, I really miss stock debian package.
Php page show error, but nothing in error log file.
I have to run this to bring the php page up:
chmod 666 /var/run/php5-fpm.sock
Thanks the post: http://www.nginxtips.com/php5-fpm-sock-failed-13-permission-denied-error/I modified file: /etc/php5/fpm/pool.d/www.conf
;listen.owner = www-data
;listen.group = www-data
;listen.mode = 0660
listen.owner = nginx
listen.group = nginx
service php5-fpm restart
Update 2: Additional installation to make it works betteraptitude install php-apc
aptitude install php5-mysqlnd
mysql_secure_installation
Update 2 on November 14, 2014:Another solution for .sock permission issue will be:
/etc/nginx/nginx.conf
#user nginx;
user www-data;
This because php5-fpm package set /var/www owner to www-data.
It will be much cleaner just set nginx run as www-data, therefor we borrow the Debian setting over.
[poll id="2"]