nginx 安装启动
2014-02-28 17:57
459 查看
[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
当出现如下情况时:
[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端口的应用;
修改端口方法:
在 Linux 上该文件的路径下找到 /usr/local/nginx/conf/nginx.conf
server { listen 80; server_name localhost; …… }
改为:
server { listen 81; server_name localhost; location / { root html; index index.html index.htm; } …… }
相关文章推荐
- 阿里云安装nginx 启动失败的原因。
- nginx在windows下的安装,以及编写启动关闭nginx等操作的脚本
- 在Linux里安装、启动nginx
- CentOS 下安装并且启动 nginx
- Linux下载安装Nginx并配置,以及启动/停止/重启命令
- linux centos安装nginx7.0 启动、重启、停止服务
- nginx安装时出现启动失败异常与解决方案记录
- nginx安装 启动 配置
- Linux上nginx的安装启动以及配合php-fpm的使用
- nginx 学习笔记(一) --- 安装和启动
- ubuntu 12.04安装部署环境nginx,tomcat,mysql以及开机启动备忘
- Nginx笔记一:Nginx简介、安装、编译优化、启动、平滑升级
- Nginx服务安装与启动脚本配置
- nginx的安装及启动
- Mac OS Nginx的安装、启动和停止
- mac下安装nginx及其启动等
- CentOS 7中Nginx1.9.5编译安装教程systemctl启动
- 编译安装nginx后service nginx start 启动不了
- nginx学习研究(一)安装启动及调试
- nginx的安装与启动