加入收藏 | 设为首页 | 会员中心 | 我要投稿 云计算网_宿迁站长网 (https://www.0527zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

CentOS 6.3安装Nginx开启目录浏览、下载功能

发布时间:2016-01-25 09:40:26 所属栏目:Linux 来源:网络整理
导读:本次实验实现目的: 安装Nginx,Nginx开启目录浏览、下载功能,开机默认启动;咐件自带开机启动脚本、重启脚本; 1、关闭SELINUX 查看获取SELinux的状态: [root

7、修改httpd配置文件

查找httpd.conf配置文件路径

[root@localhost ~]#find / -name httpd.conf

修改端口号:

修改端口号目的:httpd与nginx端口冲突,必须改其中一个端口号;

[root@localhost ~]#vim /etc/httpd/conf/httpd.conf

Listen 8080      #默认为:80,修改为:8080

8、nginx配置文件测试

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

测试成功!

Nginx: error while loading shared libraries: libpcre.so.1 报错:

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t

/usr/local/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

确认已经安装PCRE:

Shell代码

[root@localhost ~]# cd /lib

[root@localhost ~]# ls *pcre*

libpcre.so.0  libpcre.so.0.0.1

[root@localhost ~]# find / -type f -name *libpcre.so.*

添加软链接:

解决Shell代码 :(x86_bit)

[root@localhost ~]# ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1

前面在一般的linux上可以解决此问题.

注: 在有的操作系统上面,安装pcre后,安装的位置为/usr/local/lib/*pcre*

在redhat 64位机器之上有这样的情况.

在redhat 64位机器上, nginx可能读取的pcre文件为/lib64/libpcre.so.1文件.

所以在改用下面的软连接:

解决Shell代码 :(x64_bit)

[root@localhost ~]# ln -s /usr/local/lib/libpcre.so.1 /lib64/

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

9、Nginx启动

[root@localhost ~]# /usr/local/nginx/sbin/nginx

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

nginx: [emerg] still could not bind()

出现这些东西,说明服务已经启动。

(编辑:云计算网_宿迁站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!