How To Setup Your Wordpress Website Inward Nginx Server

Long agone I learned of the advantages of nginx over apache, only google it. Planned to migrate our sites but didn't contend to produce it until final weekend. So here's what I did to produce that:

I'm assuming you lot already convey a functional wordpress alongside mysql setup in addition to html / php files inwards /var/www/html (the usual).

First nosotros necessitate to install nginx in addition to php:

sudo apt-get install nginx php5-fpm 

Next, configure nginx virtual config, similar inwards apache. Default config file is at /etc/nginx/sites-available/default, re-create it in addition to edit similar below:

//copy cp /etc/nginx/sites-available/default /etc/nginx/sites-available/my-site  //modify my-site server {         psyche eighty default_server;         psyche [::]:80 default_server ipv6only=on;          beginning /var/www/html;         index index.php index.html index.htm;          server_name your_domain.com;          place / {                 # try_files $uri $uri/ =404;                 try_files $uri $uri/ /index.php?q=$uri&$args;         }          error_page 404 /404.html;          error_page 500 502 503 504 /50x.html;         place = /50x.html {                 beginning /usr/share/nginx/html;         }          place   \.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;         } }  //remove default enabled site rm /etc/nginx/sites-enabled/default  //enable my-site ln -s /etc/nginx/sites-available/my-site /etc/nginx/sites-enabled/  //restart or reload sudo service nginx restart sudo service php5-fpm restart 

Your website should straight off hold upwardly up in addition to running inwards nginx.

*Keep your pump on missing comma ;.
Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.