nginx源码安装

wget https://nginx.org/download/nginx-1.24.0.tar.gz
tar -zxf nginx-1.24.0.tar.gz
yum install -y pcre pcre-devel
yum install -y gcc gcc-c++
#yum install -y zlib-devel

cd nginx-1.24.0/

./configure
make
make install
cd /usr/local/nginx
./sbin/nginx  # 启动

80被占用更改conf
/usr/local/nginx/conf/nginx.conf
    server {
        listen       81;
        server_name  localhost;


curl http://localhost/  # 测试
curl http://localhost:81

vi /etc/profile

PATH=/opt/python3-6-10/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/nginx/sbin/

source /etc/profile

nginx -V
nginx version: nginx/1.24.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
configure arguments:

nginx -t 
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful


nginx -T

你可能感兴趣的:(nginx,运维)