Nginx部署 Yum安装nginx安装扩展源1yum -y install epel-release 安装nginx1yum -y install nginx 启动nginx12systemctl start nginxsystemctl enable nginx 编译安装nginx下载nginx源码包1https://nginx.org/en/download.html 上传到服务器并解压12tar -zxvf nginx-1.24.0.tarcd nginx-1.24.0 安装编译工具及依赖1yum install gcc openssl-devel zlib-devel pcre pcre-devel 编辑安装12345./configure --prefix=/usr/local/nginx \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_gzip_static_module \ --with-http_stub_status_module 1make -j 6 && make install 配置nginx启动文件1vim /usr/lib/systemd/system/nginx.service 123456789101112[Unit]Description=nginx - high performance web serverAfter=network.target remote-fs.target nss-lookup.target[Service]Type=forkingExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confExecReload=/usr/local/nginx/sbin/nginx -s reloadExecStop=/usr/local/nginx/sbin/nginx -s stop[Install]WantedBy=multi-user.target 启动nginx12systemctl start nginxsystemctl enable nginx 以下仅供内部部署使用12mkdir /usr/local/conf/nginx -pmkdir /home/logs/nginx -p 1vim /usr/local/nginx/conf/nginx.conf 1234567891011121314151617user root;worker_processes 1;error_log /home/logs/nginx/error.log;error_log /home/logs/nginx/error.log notice;error_log /home/logs/nginx/error.log info;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include /usr/local/conf/nginx/*.conf; access_log /home/logs/nginx/access.log;} 重启nginx 123systemctl restart nginx###或者/usr/local/nginx/sbin/nginx -s reload Nginx #Nginx Hexo迁移 上一篇 Docker安装及配置家目录 下一篇