NginX Install process Debian
apt-get update && apt-get upgrade -y
apt-get install -y nginx-full
service nginx restart
# php5-fpm Install
apt-get install -y php5-fpm
apt-get install -y php5-mysql php5-curl php5-gd php5-mcrypt
apt-get autoremove -y
mkdir /var/run/php5-fpm/
echo "cgi.fix_pathinfo=0" >>/etc/php5/fpm/php.ini
/etc/init.d/php5-fpm restart
nano /etc/nginx/sites-available/default
---------------
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.html;
autoindex on;
autoindex_exact_size off;
}
location ~ \.php$
{
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
error_page 404 /index.php;
}
-------------------
# add example.com
mkdir -p /usr/share/nginx/www/example.com
nano /etc/nginx/sites-available/example.com
----------------
server {
listen 80; ## listen for ipv4;
#listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/www/downloadbramjy.com;
index index.php index.html index.htm;
server_name alkoonsoft.com *.alkoonsoft.com www.alkoonsoft.com;
location / {
try_files $uri $uri/ /index.php;
}
if ($request_uri ~* "/(wp-admin/|wp-login.php)")
{
}
location ~ \.php$
{
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
location ~* \.(pdf)$ {
expires 30d;
}
error_page 404 /index.php;
}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
#
# root html;
# index index.html index.htm;
#
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
#
# ssl_session_timeout 5m;
#
# ssl_protocols SSLv3 TLSv1;
# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
# ssl_prefer_server_ciphers on;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
-----------------
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
# Install Mysql
apt-get install -y mysql-server
apt-get --reinstall install -y bsdutils
mysql_install_db
/etc/init.d/mysql restart
# Install WordPress
cd /usr/share/nginx/www/example.com
wget -O latest.tar.gz http://wordpress.org/latest.tar.gz
tar zxf latest-ar.tar.gz
mv wordpress/* /usr/share/nginx/www/example.com
rmdir wordpress
mv wp-config-sample.php wp-config.php
# Fix WP upload issue
chown -R www-data:www-data /usr/share/nginx/www
chmod -R g+rwx /usr/share/nginx/www
mysql -u root -p
CREATE DATABASE IF NOT EXISTS example
USE example
CREATE USER 'example'@'localhost' IDENTIFIED BY 'PASS';
GRANT ALL PRIVILEGES ON example. * TO 'example'@'localhost';