CentOS 7.3 x64 安装 Nginx

前端之家收集整理的这篇文章主要介绍了CentOS 7.3 x64 安装 Nginx前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

GCC & GCC-C++

[root@jdu4e00u53f7 ~]# yum install gcc
[root@jdu4e00u53f7 ~]# yum install gcc-c++
若未安装GCC,后续安装@R_404_196@时会报如下错误:
./configure: error: C compiler cc is not found
若未安装GCC-C++,后续安装PCRE库时会报如下错误:
configure: error: You need a C++ compiler for C++ support.

PCRE library

[root@jdu4e00u53f7 centos]# wget https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz
[root@jdu4e00u53f7 centos]# tar -zxf pcre-8.41.tar.gz
[root@jdu4e00u53f7 centos]# cd pcre-8.41
[root@jdu4e00u53f7 pcre-8.41]# ./configure 
[root@jdu4e00u53f7 pcre-8.41]# make
[root@jdu4e00u53f7 pcre-8.41]# make install
可在 [https://ftp.pcre.org/pub/pcre/](https://ftp.pcre.org/pub/pcre/) 查看最新版本。
若未安装PCRE库,后续安装@R_404_196@时会报以下错误:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option,or install the PCRE library into the system,or build the PCRE library
statically from the source with @R_404_196@ by using --with-pcre=<path> option.

ZLIB Library

[root@jdu4e00u53f7 centos]# wget http://www.zlib.net/zlib-1.2.11.tar.gz
[root@jdu4e00u53f7 centos]# tar -zxf zlib-1.2.11.tar.gz
[root@jdu4e00u53f7 centos]# cd zlib-1.2.11
[root@jdu4e00u53f7 zlib-1.2.11]# ./configure 
[root@jdu4e00u53f7 zlib-1.2.11]# make
[root@jdu4e00u53f7 zlib-1.2.11]# make install
可在 [http://www.zlib.net/](http://www.zlib.net/) 查看最新版本。
若未安装ZLIB库,后续安装@R_404_196@时会报以下错误:
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option,or install the zlib library into the system,or build the zlib library
statically from the source with @R_404_196@ by using --with-zlib=<path> option.

@R_404_196@

[root@jdu4e00u53f7 centos]# wget http://@R_404_196@.org/download/@R_404_196@-1.13.4.tar.gz
[root@jdu4e00u53f7 centos]# tar -zxf @R_404_196@-1.13.4.tar.gz
[root@jdu4e00u53f7 centos]# cd @R_404_196@-1.13.4
[root@jdu4e00u53f7 @R_404_196@-1.13.4]# ./configure 
[root@jdu4e00u53f7 @R_404_196@-1.13.4]# make
[root@jdu4e00u53f7 @R_404_196@-1.13.4]# make install
可在 [http://@R_404_196@.org/download/](http://@R_404_196@.org/download/) 查看最新版本。
@R_404_196@的默认安装位置为 /usr/local/@R_404_196@ 。
[root@jdu4e00u53f7 centos]# cd /usr/local/@R_404_196@/
[root@jdu4e00u53f7 @R_404_196@]# ls
conf  html  logs  sbin
[root@jdu4e00u53f7 @R_404_196@]# ./sbin/@R_404_196@ 
[root@jdu4e00u53f7 @R_404_196@]# ps -ef | grep @R_404_196@
root     30325     1  0 23:47 ?        00:00:00 @R_404_196@: master process ./sbin/@R_404_196@
nobody   30326 30325  0 23:47 ?        00:00:00 @R_404_196@: worker process
root     30328 14495  0 23:47 pts/1    00:00:00 grep --color=auto @R_404_196@
当前工作路径为 /user/local/@R_404_196@ 。
./sbin/@R_404_196@ 启动 @R_404_196@,默认端口为80修改端口号可编辑 ./conf/@R_404_196@.conf 中的"listen 80;",如可以修改"listen 8080;"35     server {
     36         listen       8080;
     37         server_name  localhost;
     38 
     39         #charset koi8-r;
     40 
     41         #access_log logs/host.access.log main;
     42 
     43         location / {
     44             root   html;
     45             index  index.html index.htm;
     46         }
 保存退出后使用 "./sbin/@R_404_196@ -s reload" 重新加载配置文件

猜你在找的CentOS相关文章