centos7安装nginx教程

centos7安装nginx教程

nginx版本:1.20.1

1、下载

wget http://nginx.org/download/nginx-1.20.1.tar.gz

2、安装

yum install pcre-devel openssl-devel -y   #安装依赖包

tar -xzf nginx-1.20.1.tar.gz

cd nginx-1.20.1

./configure --prefix=/usr/local/nginx --with-stream --with-http_ssl_module

make

make install

3、nginx配置

worker_processes  4;

pid        logs/nginx.pid;

events {

    worker_connections  1024;

}

http {

    include       mime.types;

    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;

    client_max_body_size 10m;

    keepalive_timeout  65;

    gzip  on;

   

    upstream schedule-server {

        server 10.210.11.75:8087;

    }

    include vhost/*.conf;

}

4、启动

/usr/local/nginx/sbin/nginx

原文地址:https://www.cnblogs.com/qiansm/p/15241148.html