首页 > 代码库 > nginx安装

nginx安装

linux下安装安装pcre-8.36configure: error: You need a C++ compiler for C++ support

[root@localhostpcre-8.36]# ./configure

………………………………………………

configure:error: You need a C++ compiler for C++ support.

[root@localhostpcre-8.36]# yum install -y gcc gcc-c++

[root@localhost/]# /application/nginx-1.6.2/sbin/nginx -t

/application/nginx-1.6.2/sbin/nginx:error while loading shared libraries: libpcre.so.1: cannot open shared objectfile: No such file or directory

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

/lib/libpcre.so.0

/lib/libpcre.so.0.0.1

/root/sky9890/pcre-8.36/.libs/libpcre.so.1

/root/sky9890/pcre-8.36/.libs/libpcre.so.1.2.4

/root/sky9890/pcre-8.36/.libs/libpcre.so

/usr/local/lib/libpcre.so.1

/usr/local/lib/libpcre.so.1.2.4

/usr/local/lib/libpcre.so

[root@localhost/]# vi /etc/ld.so.conf

includeld.so.conf.d/*.conf

/usr/local/lib

[root@localhost/]# ldconfig

[root@localhost/]# /application/nginx-1.6.2/sbin/nginx -t

nginx:the configuration file /application/nginx-1.6.2/conf/nginx.conf syntax is ok

nginx:configuration file /application/nginx-1.6.2/conf/nginx.conf test is successful

[root@localhostsbin]# lsof -i :80

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

nginx   10827 root    6u  IPv4 37106    0t0  TCP *:http (LISTEN)

nginx10828 nginx 3u IPv4  37110 0t0 TCP192.168.152.130:http->192.168.152.1:webobjects (ESTABLISHED)

nginx   10828  nginx   6u  IPv4  37106   0t0  TCP *:http (LISTEN)

nginx10828 nginx  10u  IPv4 37112 0t0 TCP 192.168.152.130:http->192.168.152.1:proofd(ESTABLISHED)

提示:注意80端口冲突

如果出不来Welcome to Nginx的内容页面,请从下面原因中依次排查:

1.    iptables防火墙和selinux是否关闭。

[root@localhostsbin]# /etc/init.d/iptables stop

#这是关闭防火墙的命令,如果是外网IP生产环境请允许80端口的访问,而不是关闭防火墙

[root@localhostsbin]# chkconfig iptables off

#非正式环境可以禁止防火墙开机自启动,便于学习调式nginx服务。

[root@localhostsbin]# /etc/init.d/iptables status #查看iptablesr 当前状态

2.关闭selinux:

[root@localhostsbin]#setenforce 0 #这是临时关闭方法

[root@localhostsbin]# cat /etc/selinux/config |grep SELINUX=disabled #永久关闭地点

 

3.通过下面命令确认httpd端口80是否存在:

[root@localhostsbin]# netstat -lnt|grep 80

tcp        0     0 0.0.0.0:80                 0.0.0.0:*                   LISTEN  

4.查看是否有httpd进程存在

[root@localhostsbin]# ps -ef|grep nginx

root     10827    1  0 18:35 ?        00:00:00 nginx: master process ./nginx

nginx    10828 10827 0 18:35 ?        00:00:00 nginx:worker process

root     10904 1387  0 18:54 pts/0    00:00:00 grep nginx

5.在服务器本地wget http://192.168.152.130测试


本文出自 “Linux~DBA~MBA” 博客,请务必保留此出处http://sky9896.blog.51cto.com/2330653/1598897

nginx安装