00044-centos 安装nginx
2022/2/5 7:15:55
本文主要是介绍00044-centos 安装nginx,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
要安装nginx的依赖pcre
wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.44/pcre-8.44.tar.gz
tar -xvf pcre-8.44.tar.gz
cd pcre-8.44
安装编译
./configure
这里出错:
configure: error: no acceptable C compiler found in $PATH
需要安装GCC软件套件
yum install gcc
安装后,再运行: ./configure
这里继续出错:
configure: error: Invalid C++ compiler or C++ compiler flags
安装:
yum install -y gcc-c++
安装后,再运行: ./configure
到这里,OK。
make && make install
查看pcre版本
pcre-config --version
开始安装nginx:
wget https://nginx.org/download/nginx-1.20.0.tar.gz
tar -xvf nginx-1.20.0.tar.gz
cd nginx-1.20.0
编译安装
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/pcre-8.44
这里出错:./configure: error: SSL modules require the OpenSSL library.
解决方法:执行以下命令:
yum -y install openssl openssl-devel
再执行上个安装命令,OK。
make && make install
查看版本
/usr/local/nginx/sbin/nginx -v
安装完毕。
启动命令:
/usr/local/nginx/sbin/nginx (无参数) 启动
/usr/local/nginx/sbin/nginx -s stop (-s stop)关闭
/usr/local/nginx/sbin/nginx -s reload (-s reload)重启
浏览器输入ip:80, 即可访问。
查看防火墙:
systemctl status firewalld.service
systemctl stop firewalld.service(停止防火墙)
systemctl start firewalld.service(打开防火墙)
开放端口:
firewall-cmd --zone=public --add-port=10001/tcp --permanent firewall-cmd --zone=public --add-port=10002/tcp --permanent firewall-cmd --reload
这篇关于00044-centos 安装nginx的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-29fail2ban nginx
- 2024-03-18install nginx proxy manager
- 2024-01-2444从零开始用Rust编写nginx,命令行参数的设计与解析及说明
- 2024-01-22比Nginx更好用的Gateway!
- 2024-01-17nginx daemon off
- 2023-12-30Nginx Vhost Traffic Status 是什么意思-icode9专业技术文章分享
- 2023-12-26使用nginx搭建creates.io镜像(稀疏索引)
- 2023-11-18centos7编译安装Nginx教程。
- 2023-11-02nginx启动命令和停止命令
- 2023-10-25Centos7系统Nginx负载均衡如何安装和配置?