Results 1 to 9 of 9
Threaded View
-
27th May 2012, 04:08 PM #1OPMember
Nginx on Linux VPS - Newbie Freindy, the Complete Guide
Hey guys,
This is my first tutorial. I was just browsing ‘Tutorials and Guides’ section and noticed few Nginx related tutorials. But none of them were complete tutorials. I mean installing Nginx is just a piece of big pie. You need to prepare your Linux for it. And after installation, what should you do? Can you install a WordPress or PHP base applications? Well, you can try your luck.
So I don’t have time to write all this. I have it covered on my blog ‘Step-by-Step Guide to WordPress on Nginx Server’. What I’m going to do here is, tell you the proper way of installing latest version of Nginx on an Ubuntu VPS. All additional details and background can be found at above mentioned post. And remember this is just a one part of many.
I need latest version of Nignx. So I won’t mess with integrated packages. I’ll install it from source. So we need to collect some dependency files. Below code will do it,
Code:sudo aptitude -y install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
Code:mkdir ~/sources cd ~/sources/
Code:wget http://nginx.org/download/nginx-1.2.0.tar.gz
Code:tar -zxvf nginx-1.0.12.tar.gz
Code:cd nginx-1.0.12
Code:./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
Code:make sudo make install
Code:sudo /usr/local/sbin/nginx
That’s it right? No not exactly.
Nginx won’t auto start on reboots. So let’s make it happen.
First kill Nginx,
Code:sudo kill `cat /usr/local/nginx/logs/nginx.pid`
Code:sudo nano /etc/init.d/nginx
Code:#! /bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/local/sbin/nginx NAME=nginx DESC=nginx test -x $DAEMON || exit 0 # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then . /etc/default/nginx fi set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON sleep 1 start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS echo "$NAME." ;; reload) echo -n "Reloading $DESC configuration: " start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid --exec $DAEMON echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0
Code:sudo chmod +x /etc/init.d/nginx sudo /usr/sbin/update-rc.d -f nginx defaults
Code:sudo nano /usr/local/nginx/conf/nginx.conf
Code:user www-data www-data; worker_processes 4; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; tcp_nopush on; tcp_nodelay off; keepalive_timeout 5; gzip on; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; include /usr/local/nginx/sites-enabled/*; }
Let’s create Virtual Host File Structure & Symlinks,
We need 2 new folders
Code:sudo mkdir /usr/local/nginx/sites-available sudo mkdir /usr/local/nginx/sites-enabled
Code:sudo nano /usr/local/nginx/sites-available/default
Code:server { listen 80; server_name localhost; location / { root html; index index.php index.html index.htm; } # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
Code:sudo ln -s /usr/local/nginx/sites-available/default /usr/local/nginx/sites-enabled/default
Code:sudo /etc/init.d/nginx start
That’s it! Nginx is now working properly. Remember this is 5th post of my Nginx series. All other tutorials are available at my blog.
Source - Install and Configure Nginx Web Server on Ubuntu VPSFreddy63 Reviewed by Freddy63 on . Nginx on Linux VPS - Newbie Freindy, the Complete Guide Hey guys, This is my first tutorial. I was just browsing ‘Tutorials and Guides’ section and noticed few Nginx related tutorials. But none of them were complete tutorials. I mean installing Nginx is just a piece of big pie. You need to prepare your Linux for it. And after installation, what should you do? Can you install a WordPress or PHP base applications? Well, you can try your luck. So I don’t have time to write all this. I have it covered on my blog ‘Step-by-Step Guide to WordPress on Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Complete Setup Guide for Linux Seedboxes (Fedora Core/CentOS/Debian/Ubuntu)
By SceneMan in forum Tutorials and GuidesReplies: 12Last Post: 23rd Jan 2012, 10:21 AM -
Complete DVD Ripping Guide Using Handbrake (Easy to Use n Rip)
By Faizann20 in forum Tutorials and GuidesReplies: 10Last Post: 10th Jan 2012, 12:45 AM -
[Tutorial] Complete Guide to IDM | How to Setup IDM
By BAD BOY in forum Tutorials and GuidesReplies: 7Last Post: 30th Sep 2010, 08:01 AM -
Torrents - A complete Guide.
By lakshyak in forum Tutorials and GuidesReplies: 1Last Post: 20th Jan 2008, 08:54 AM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...