Nginx 安装
CentOS 系统
| |
| rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm |
| rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm |
| |
| |
| yum install nginx |
| |
| |
| service nginx start |
| systemctl restart nginx |
在线安装
| # 在线安装 |
| apt-get install nginx |
| # 启动服务 |
| service nginx start |
常用命令
| # 显示环境 |
| nginx -V |
| # 检测配置文件是否正确,会告诉你配置文件的位置/etc/nginx/nginx.conf |
| nginx -t |
安装 pcre 依赖
安装 zlib 依赖
依赖包:安装zlib
编译源代码安装
| 准备源代码: http://nginx.org/en/download.html |
| |
| https://www.openssl.org/source/ |
| 下载最新版本的openssl-fips包 |
| tar -xvf openssl-fips-2.0.16.tar.gz |
| cd openssl-fips-2.0.16 |
| ./config |
| make |
| make install |
| 编译安装 |
| tar -xvf nginx-1.14.0.tar.gz |
| cd nginx-1.14.0 |
| |
| ./configure --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-fips-2.0.16 |
| |
| ./configure --with-stream=dynamic --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-fips-2.0.16 |
| ./configure --with-stream=dynamic --with-pcre=../pcre-8.43 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-fips-2.0.16 |
| make |
| make install |
| |
| |
| /usr/local/nginx/sbin/nginx -t |
| |
| /usr/local/nginx/conf/nginx.conf |
| |
| /usr/local/nginx/sbin/nginx |
| |
| /usr/local/nginx/sbin/nginx -s reload |
| |
| 参考文档: |
| http://nginx.org/en/docs/configure.html |
查看 nginx 信息
| [root@loanapp tomcat-fssdemo] |
| nginx version: nginx/1.12.2 |
| built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) |
| built with OpenSSL 1.0.2k-fips 26 Jan 2017 |
| TLS SNI support enabled |
| configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?