-
Notifications
You must be signed in to change notification settings - Fork 1
NGINX, PHP and MySQL
Chris Poyzer edited this page Jul 31, 2014
·
1 revision
sudo apt-get install nginx
sudo apt-get install mysql-server mysql-client
sudo mysql_secure_installation
sudo apt-get install php5-fpm php5-cli php5-mysql
# optional
cd /etc/php5/cli
sudo mv php.ini php.ini.backup
sudo ln -s ../fpm/php.ini
/etc/php5/fpm/pool.d/www.conf
user = <user>
group = <group>
listen = /tmp/php5-fpm.sock
listen.owner = <user>
listen.group = <group>
listen.mode = 0660
nginx sites-available/<file>
upstream php {
server unix:/run/php5-fpm.sock;
}
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /home/<user>/www;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /home/<user>/www;
# factcgi_intercept_errors on;
include fastcgi_params;
}
}
sudo service nginx restart
sudo service php5-fpm restart