Linux安装nginx

安装PCRE:
这里下载最新的PRCE 
然后进行安装:
解压到opt下的pcre 文件夹中
tar -xf  pcre-8.37.tar 
然后再 /usr/local/下创建软链
ln -s /opt/pcre/pcre-8.37 pcre

然后再pcre中创建
vim cc.sh
./configure --prefix=/usr/local/pcre ##pcre的安装路径
然后执行cc.sh
如果执行的时候提示 configure: error: You need a C++ compiler for C++ support.
那么执行 
yum install -y gcc gcc-c++

显示安装信息:
pcre-8.37 configuration summary:

    Install prefix .................. : /usr/local/pcre
    C preprocessor .................. : gcc -E
    C compiler ...................... : gcc
    C++ preprocessor ................ : g++ -E
    C++ compiler .................... : g++
    Linker .......................... : /usr/bin/ld -m elf_x86_64
    C preprocessor flags ............ :
    C compiler flags ................ : -g -O2 -fvisibility=hidden
    C++ compiler flags .............. : -O2 -fvisibility=hidden -fvisibility-inlines-hidden
    Linker flags .................... :
    Extra libraries ................. :

    Build 8 bit pcre library ........ : yes
    Build 16 bit pcre library ....... : no
    Build 32 bit pcre library ....... : no
    Build C++ library ............... : yes
    Enable JIT compiling support .... : no
    Enable UTF-8/16/32 support ...... : no
    Unicode properties .............. : no
    Newline char/sequence ........... : lf
    \R matches only ANYCRLF ......... : no
    EBCDIC coding ................... : no
    EBCDIC code for NL .............. : n/a
    Rebuild char tables ............. : no
    Use stack recursion ............. : yes
    POSIX mem threshold ............. : 10
    Internal link size .............. : 2
    Nested parentheses limit ........ : 250
    Match limit ..................... : 10000000
    Match limit recursion ........... : MATCH_LIMIT
    Build shared libs ............... : yes
    Build static libs ............... : yes
    Use JIT in pcregrep ............. : no
    Buffer size for pcregrep ........ : 20480
    Link pcregrep with libz ......... : no
    Link pcregrep with libbz2 ....... : no
    Link pcretest with libedit ...... : no
    Link pcretest with libreadline .. : no
    Valgrind support ................ : no
    Code coverage ................... : no
然后执行make&&make install
PCRE安装完成
===========================================

然后执行:
yum -y install pcre-devel openssl openssl-devel

然后
再nginx目录下
设置 vim cc.sh
./configure --prefix=/usr/local/nginx
 
make
 
make install


这时候 再nginx sbin目录启动nginx
如果提示error log不存在,nginx.pid不存在的话
[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 
使用nginx -c的参数指定nginx.conf文件的位置
 
[root@localhost nginx]# cd logs/
[root@localhost logs]# ll
总用量 12
-rw-r--r-- 1 root root 1246 12月  9 18:10 access.log
-rw-r--r-- 1 root root  516 12月 10 15:39 error.log
-rw-r--r-- 1 root root    5 12月 10 15:38 nginx.pid

q
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
这个报错的处理 

[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
如果遇到这个问题 ,那么就把 nginx端口号先禁止掉 然后再启动一下就可以了
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值