ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# nginx安装 在home目录下创建一个src目录 cd src目录 ``` wget http://nginx.org/download/nginx-1.12.2.tar.gz 下载 ``` ``` tar -xf tar -xf nginx-1.12.2.tar.gz 解压压缩包 ``` ``` cd nginx-1.12.2 打开文件夹 ``` ``` groupadd www 创建组 ``` ``` useradd -g www www -M -s /sbin/nologin //创建目录与权限 ``` ``` ./configure --help 所有配置的列表项目选择 ``` 以下为配置文件--user=www 是修改成了www --group=www 是修改成了www , prefix=/usr/local/nginx 为安装目录 ``` ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_sub_module --with-pcre ``` ``` 注意::(如果出现 ./configure: error: C compiler cc is not found错误)yum install gcc gcc++ -y 解决安装gcc 注意:: 出现 (./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 nginx by using --with-pcre=<path> option.)错误后 yum -y install pcre-devel 安装PCRE 注意::出现(./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option. )错误后 yum -y install openssl openssl-devel 安装OpenSSL解决 ``` ## 出现这个为安装成功 ![](https://img.kancloud.cn/ed/4c/ed4cb415414d118a2c1cf684183c1806_1009x599.png) 检测上个语法0错误 ![](https://img.kancloud.cn/ab/06/ab064333b878d87a55a94c028a3e6dd4_591x166.png) # 执行 安装命令 ``` make && make install ``` ![](https://img.kancloud.cn/e0/5b/e05b22dc75ff6959269b70a79bbbb625_675x647.png) # nginx安装成功 nginx目录 ``` ll /usr/local/nginx/ ``` ![](https://img.kancloud.cn/2a/f9/2af90da13d422c229163dc4390d3c16f_803x261.png) # 启动nginx 关闭防火墙 ``` systemctl stop firewalld.service ``` <br/> ll /usr/local/nginx 进入nginx目录 nginx在根目录下 /usr/local/nginx ``` cd /usr/local/nginx cd sbin ./nginx ``` # 启动成功 ![](https://img.kancloud.cn/9b/a7/9ba75351e480192d2d141c018fbeb445_1355x561.png) ## 外网访问成功