Skip to content

Instantly share code, notes, and snippets.

@trajche
Last active December 16, 2015 04:51
Show Gist options
  • Save trajche/30808953b5b1a7b76201 to your computer and use it in GitHub Desktop.
Save trajche/30808953b5b1a7b76201 to your computer and use it in GitHub Desktop.
Installing new box for nginx-wordpress (ubuntu minimal):
Prepare server
------------------------------------
apt-get update
apt-get upgrade
apt-get dist-upgrade #upgrade distribution
apt-get install sudo dialog software-properties-common python-software-properties
apt-get install bsdutils #for percona
Install Nginx + PHP
----------------------------------------
apt-get update
apt-get install nginx
apt-get install php5-fpm
apt-get install php5-common php5-mysqlnd php5-xmlrpc php5-curl php5-gd php5-cli php5-fpm php-pear php5-dev php5-imap php5-mcrypt
vi /etc/php5/fpm/php.ini
Find the line, cgi.fix_pathinfo=1, and change the 1 to 0. (cgi.fix_pathinfo=0)
service php5-fpm restart
vi /etc/nginx/sites-available/default
Install Percona
------------
apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
echo "deb http://repo.percona.com/apt `lsb_release -cs` main" >> /etc/apt/sources.list.d/percona.list
echo "deb-src http://repo.percona.com/apt `lsb_release -cs` main" >> /etc/apt/sources.list.d/percona.list
apt-get update
sudo apt-get install percona-server-server-5.6 percona-server-client-5.6
Install postfix
-------------
sudo apt-get install postfix
Nginx Configuration
-------------
server {
listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
root /var/www/domainname;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name domainname.mk;
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/domainname;
}
location ~ \.php$ {
#try_files $uri =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 120;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment