Nginx部署
2022/2/6 7:34:18
本文主要是介绍Nginx部署,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、安装依赖
yum install -y bind-utils pcre pcre-devel make zlib zlib-devel gcc-c++ libtool openssl openssl-devel wget gcc gcc-c++ zip unzip tree vim telnet lrzsz net-tools yum-utils
2、下载解压
wget http://nginx.org/download/nginx-1.13.12.tar.gz tar -zxvf nginx-1.13.12.tar.gz
3、编译安装
cd nginx-1.13.12/ ./configure --prefix=/usr/local/nginx --with-http_ssl_module make && make install
4、配置文件模板
[root@nginx_test conf]# more nginx.conf #user nobody; worker_processes 1; worker_rlimit_nofile 65535; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { use epoll; worker_connections 51200; multi_accept on; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 512; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; #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; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; include dooffe/*.conf; }
# 多域名配置目录 mkdir /usr/local/nginx/conf/{dooffe,cert}
5、配置开机自启
vim /usr/lib/systemd/system/nginx.service
[Unit] Description=nginx service After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl daemon-reload systemctl enable nginx systemctl restart nginx systemctl status nginx
这篇关于Nginx部署的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-29Nginx发布学习:从入门到实践的简单教程
- 2024-10-28Nginx发布:新手入门教程
- 2024-10-21nginx 怎么设置文件上传最大20M限制-icode9专业技术文章分享
- 2024-10-17关闭 nginx的命令是什么?-icode9专业技术文章分享
- 2024-09-17Nginx实用篇:实现负载均衡、限流与动静分离
- 2024-08-21宝塔nginx新增8022端口方法步骤-icode9专业技术文章分享
- 2024-08-21nginx配置,让ws升级为wss访问的方法步骤-icode9专业技术文章分享
- 2024-08-15nginx ws代理配置方法步骤-icode9专业技术文章分享
- 2024-08-14nginx 让访问带有/relid的地址返回404 ,例子 /relid-x-0.36-y-131.html-icode9专业技术文章分享
- 2024-08-14nginx 判断地址有/statics/的路径,指向到/home/html/statics/目录-icode9专业技术文章分享