Nginx安装

2020-06-08  本文已影响0人  羁绊_87cd

安装编译工具及库文件

yum -y install make zlib zlib-devel gcc-c++ libtool  openssl openssl-devel

安装nginx

wget https://nginx.org/download/nginx-1.19.0.tar.gz
tar -zxvf  nginx-1.19.0.tar.gz
cd nginx-1.19.0
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
make && make install

为了方便我们将nginx加入环境变量

vim ~/.bashrc
在文件最后增加
export PATH=/usr/local/nginx/sbin:$PATH
source ~/.bashrc

下面给出nginx常用命令

重新加载配置文件
nginx –s reload 
停止nginx
nginx –s stop
检查配置文件是否正确
nginx –t
查看当前nginx的编译信息
nginx –V
强制关闭nginx
pkill nginx

开通 80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

如出现如下界面,则nginx安装成功。


上一篇 下一篇

猜你喜欢

热点阅读