No network installed Nginx on CentOS

1) download nginx

wget http://nginx.org/download/nginx-0.8.54.tar.gz

Download by default to the current directory, or list of pwd

2) extract

tar zxvf nginx-
.
.tar.gz

Enter CD nginx directory nginx-0.8.54
3)

./configure

Configure this step may occur, PCRE was not found error
So if you can network recommends using the yum command to install dependencies.

yum -y install gcc pcre-devel openssl openssl-devel

If there are no networks available for CentOS 5.5 DVD to find packages, in order to install

rpm -ivh pcre-devel-6.6-2.el5_1.7.i386.rpm
rpm -ivh openssl-0.9.8e-12.el5_4.6.i386.rpm
rpm -ivh e2fsprogs-devel-1.39-23.el5.i386.rpm
rpm -ivh keyutils-libs-devel-1.2-1.el5.i386.rpm
rpm -ivh libsepol-devel-1.15.2-3.el5.i386.rpm
rpm -ivh libselinux-devel-1.33.4-5.5.el5.i386.rpm
rpm -ivh krb5-devel-1.6.1-36.el5_4.1.i386.rpm
rpm -ivh zlib-devel-1.2.3-3.i386.rpm
rpm -ivh openssl-devel-0.9.8e-12.el5_4.6.i386.rpm

After installing and then do./configure
Finally will see information similar to the following, indicate a successful compile

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1 library is not used
+ using system zlib library

4)

make

5)

make install

Installed by default to the

/usr/local/nginx

Under nginx

6) start

/usr/local/nginx/sbin/nginx

See if start successfully

[root@maomao sbin]# ps aux | grep nginx
root 10391 0.0 0.0 4008 456 ? Ss 10:48 0:00 nginx: [b][color=red]master[/color][/b] process ./nginx
nobody 10392 0.0 0.0 4164 796 ? S 10:48 0:00 nginx: worker process

Successfully started, master is the master process, closing kill this process, other processes will automatically turn off

Open the default browser to http://localhost/to see nginx welcome page
Welcome to nginx!

Nginx is used by default on port 80, we can install nginx directory changes to the conf/nginx.conf file.

vim /usr/local/nginx/conf/nginx.conf

Locate the following snippet changes, and then restart the

server {
listen 80; Port
server_name localhost; Binding domain
location / {
root html; Default directory
index index.html index.htm; Default Home name
}
}

Changes after the restart nginx.

kill -HUP ‘cat /usr/local/nginx/logs/nginx.pid’

HUP signal is a smooth restart

Stopping nginx

kill ‘cat /usr/local/nginx/logs/nginx.pid’

Then visit http://localhost/page could not be opened.

Leave a Reply

Your email address will not be published. Required fields are marked *