FUCK APACHE AND GET THE REAL SHIT
_________________________________________________________________
So over the past couple of days ive been playing around with web servers and from my point of this webserver i will teach you how to install today is BY Far better then apache or lighttpd
Apache - uses to much shit that is loading unwanted services
Lighttpd- waste way to much ram aka leaks it
we will be installing Nginx
Why?
well i have find out that
it is by far the best uses less resources and its way faster
You can install these on
Debian, emerge on Gentoo, ports on FreeBSD , and windows
By via Apt-get usually
i will be installing it on ubuntu as thats what i have as my second os on my pc
We will be installing from source
First install these dependency files
Create a directory to store Nginx
Change to that directory
Now we need to download it
then go into the folder
and there you go now moving onto the building blahblah blah blah blah shit
_________________________________________________________________
We will compile it telling it where to install and to include SSL
now its time to install it
And start it up
Now test it up go into your internet and type in your ip address you should see welcome
moving on
Now were going to stop it
whola now its installed
__________________________________________________________________
Now its time to make it start up restart or stop when needed
So now lets create a file
and paste this
then give the file permissions and make the script run on reboot, else start/stop/restart when required
now its time to edit the .conf
Delete the content best way to do it is CTRL-K
and put this in there
____________________________________________________________________________
now its time to create the Virtual Host File and symlinks
The Nginx file structure is fucked up for sites so we need to fix that
First we need to make some new folders
the first is for our virtual host (vhost) files, the second is their
corresponding symlinks which will be referenced by Nginx' config file.
What are VHOST and sysmlinks?
so now we need a default vhost file, and that goes in the sites-available folder
and paste this
and enable it with symlink
now its time to boot up
and there you have it
_________________________________________________________________
So over the past couple of days ive been playing around with web servers and from my point of this webserver i will teach you how to install today is BY Far better then apache or lighttpd
Apache - uses to much shit that is loading unwanted services
Lighttpd- waste way to much ram aka leaks it
we will be installing Nginx
Why?
well i have find out that
it is by far the best uses less resources and its way faster
You can install these on
Debian, emerge on Gentoo, ports on FreeBSD , and windows
By via Apt-get usually
i will be installing it on ubuntu as thats what i have as my second os on my pc
We will be installing from source
First install these dependency files
Code:
sudo aptitude -y install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
Create a directory to store Nginx
Code:
mkdir ~/sources
Change to that directory
Code:
cd ~/sources/
Now we need to download it
Code:
wget http://sysoev*****nginx/nginx-0.7.64.tar.gz
Code:
tar -zxvf nginx-0.7.64.tar.gz
then go into the folder
Code:
cd nginx-0.7.64
and there you go now moving onto the building blahblah blah blah blah shit
_________________________________________________________________
We will compile it telling it where to install and to include SSL
Code:
./configure --sbin-path=/usr/local/sbin --with-http_ssl_module
now its time to install it
Code:
make
sudo make install
And start it up
Code:
sudo /usr/local/sbin/nginx
Now test it up go into your internet and type in your ip address you should see welcome
moving on
Now were going to stop it
Code:
sudo kill `cat /usr/local/nginx/logs/nginx.pid`
whola now its installed
__________________________________________________________________
Now its time to make it start up restart or stop when needed
So now lets create a file
Code:
sudo nano /etc/init.d/nginx
and paste this
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
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
then give the file permissions and make the script run on reboot, else start/stop/restart when required
Code:
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
now its time to edit the .conf
Code:
sudo nano /usr/local/nginx/conf/nginx.conf
Delete the content best way to do it is CTRL-K
and put this in there
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/*;
____________________________________________________________________________
now its time to create the Virtual Host File and symlinks
The Nginx file structure is fucked up for sites so we need to fix that
First we need to make some new folders
Code:
sudo mkdir /usr/local/nginx/sites-available
sudo mkdir /usr/local/nginx/sites-enabled
the first is for our virtual host (vhost) files, the second is their
corresponding symlinks which will be referenced by Nginx' config file.
What are VHOST and sysmlinks?
You have one of each per domain, and one of each for the default settings.
The symlink, or symbolic link, references the web server to the virtual host file.
The vhost file is a configuration file. It tells the web server, for example, things like where the web files live or the kind of URI structure you want.
so now we need a default vhost file, and that goes in the sites-available folder
Code:
sudo nano /usr/local/nginx/sites-available/default
and paste this
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;
}
and enable it with symlink
Code:
sudo ln -s /usr/local/nginx/sites-available/default /usr/local/nginx/sites-enabled/default
now its time to boot up
Code:
sudo /etc/init.d/nginx start
and there you have it