首页 > 其他 > 详细

nginx 安装启动

时间:2014-03-01 04:14:26      阅读:450      评论:0      收藏:0      [点我收藏+]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@localhost ~]# wget http://nginx.org/download/nginx-0.7.67.tar.gz         
--2010-09-24 14:48:12--  http://nginx.org/download/nginx-0.7.67.tar.gz         
Resolving nginx.org... 81.19.68.137                                            
Connecting to nginx.org|81.19.68.137|:80... connected.                         
HTTP request sent, awaiting response... 200 OK                                 
Length: 608462 (594K) [application/octet-stream]                               
Saving to: `nginx-0.7.67.tar.gz‘                                               
100%[<========================================>] 608,462     44.5K/s   in 18s    
2010-09-24 14:48:32 (32.8 KB/s) - `nginx-0.7.67.tar.gz‘ saved [608462/608462]  
                                                                                 
[root@localhost ~]# tar -zxvf nginx-0.7.67.tar.gz    /解压压缩文件             
[root@localhost ~]# cd nginx-0.7.67                  /进入安装文件目录         
[root@localhost nginx-0.7.67]# ./configure –prefix=/usr/local/nginx      /指定安装到/usr/local/nginx目录下,可用./configure –help查看需要哪些编译参数      
[root@localhost nginx-0.7.67]#make                  /make                      
[root@localhost nginx-0.7.67]#make install          /安装                      
[root@localhost nginx-0.7.67]# ll /usr/local/nginx/      /查看是否安装成功     
drwxr-xr-x 2 root root 4096 Sep 24 15:12 conf                                  
drwxr-xr-x 2 root root 4096 Sep 24 15:12 html                                  
drwxr-xr-x 2 root root 4096 Sep 24 15:12 logs                                  
drwxr-xr-x 2 root root 4096 Sep 24 15:12 sbin                                  
[root@localhost nginx-0.7.67]#/usr/local/nginx/sbin/nginx –t     /测试Nginx配置文件是否正确                                                                 
[root@localhost nginx-0.7.67]#/usr/local/nginx/sbin/nginx         /启动Nginx  

  当出现如下情况时:

1
2
3
4
5
6
7
[root@web2 nginx-0.7.67]# /usr/local/nginx_test/sbin/nginx
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
[emerg]: still could not bind()

  就要修改nginx的端口或者关掉占用80端口的应用;

修改端口方法:

1
在 Linux 上该文件的路径下找到  /usr/local/nginx/conf/nginx.conf
1
2
3
4
5
6
server {
    listen       80;
    server_name  localhost;
     
    ……
}

  改为:

1
2
3
4
5
6
7
8
9
10
server {
    listen       81;
    server_name  localhost;
     
    location / {
        root   html;
        index  index.html index.htm;
    }
    ……
}

  

nginx 安装启动,布布扣,bubuko.com

nginx 安装启动

原文:http://www.cnblogs.com/yixiwenwen/p/3574097.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!