nginx

1、检查pcre 软件包是否安装.

[nginx@axwaydemo ~]$ rpm -qa pcre
pcre-7.8-6.el6.i686
pcre-7.8-6.el6.x86_64

如没有安装使用yum进行安装

[nginx@axwaydemo Packages]$ pcre-7.8-6.el6.x86_64

2、解压.

[nginx@axwaydemo ~]$ tar zxvf nginx-1.6.0.tar.gz
[nginx@axwaydemo ~]$ cd nginx-1.6.0
[nginx@axwaydemo nginx-1.6.0]$ ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src

3、创建安装目录

[nginx@axwaydemo ~]$ mkdir nginx

4、编译安装 并指定路径

[nginx@axwaydemo nginx-1.6.0]$ ./configure --prefix=/home/nginx/nginx/

[nginx@axwaydemo nginx-1.6.0]$ make && make install

5、验证安装

    进入到安装目录

[nginx@axwaydemo sbin]$ pwd
/home/nginx/nginx/sbin
[nginx@axwaydemo sbin]$ ls
nginx

[nginx@axwaydemo sbin]$ ./nginx -h
nginx version: nginx/1.6.0
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal to a master process: stop, quit, reopen, reload
  -p prefix     : set prefix path (default: /home/nginx/nginx//)
  -c filename   : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file

 

[nginx@axwaydemo sbin]$ ./nginx -v
nginx version: nginx/1.6.0
[nginx@axwaydemo sbin]$ ./nginx -t
nginx: the configuration file /home/nginx/nginx//conf/nginx.conf syntax is ok
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
nginx: configuration file /home/nginx/nginx//conf/nginx.conf test failed

 

6、启动nginx

[nginx@axwaydemo sbin]$ ./nginx

7、修改监听端口 并网页访问

[nginx@axwaydemo conf]$ pwd
/home/nginx/nginx/conf
[nginx@axwaydemo conf]$ vim nginx.conf

默认端口80 本文中修改为8000

    server {
        listen       8000;
        server_name  localhost;

http://192.168.0.10:8000

你可能感兴趣的:(nginx)