|
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; } ……} |
原文:http://www.cnblogs.com/yixiwenwen/p/3574097.html