本站教程收集整理的这篇文章主要介绍了nginx学习三:nginx安装,本站教程本站觉得挺不错的,现在分享给大家,也给大家做个参考。
Nginx安装
官网:@R_607_10107@s://nginx.org/
安装方式
@H_673_6@
@H_673_6@
@H_673_6@
@H_673_6@
安装步骤
-
配置 Nginx yum 源(必须使用官方源)
vim /etc/yum.repos.d/Nginx.repo [Nginx-stable] name=Nginx stable repo baseurl=@R_607_10107@://Nginx.org/packages/centos/7/$basearch/ gpgcheck=1 enabled=1 gpgkey=@R_607_10107@s://Nginx.org/keys/Nginx_signing.key module_hotfixes=true
-
安装Nginx,必须安装官方源Nginx
yum repolist # 查看有哪些仓库 yum list Nginx # 查看 Nginx 有哪些 yum install Nginx Nginx -v # 测试版本 问题一:如果企业之前的Nginx都是通过源码安装,这是需要我们部署新的Nginx服务器,怎么实现? 答: # 官方源 Nginx 带的编译选项 Nginx -V [root@localhost ~]# Nginx -V Nginx version: Nginx/1.16.1 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=/etc/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 --@R_607_10107@-log-path=/var/log/Nginx/access.log --pid-path=/var/run/Nginx.pid --lock-path=/var/run/Nginx.lock --@R_607_10107@-client-body-temp-path=/var/cache/Nginx/client_temp --@R_607_10107@-proxy-temp-path=/var/cache/Nginx/proxy_temp --@R_607_10107@-fastcgi-temp-path=/var/cache/Nginx/fastcgi_temp --@R_607_10107@-uwsgi-temp-path=/var/cache/Nginx/uwsgi_temp --@R_607_10107@-scgi-temp-path=/var/cache/Nginx/scgi_temp --user=Nginx --group=Nginx --with-compat --with-file-aio --with-threads --with-@R_607_10107@_addition_module --with-@R_607_10107@_auth_request_module --with-@R_607_10107@_dav_module --with-@R_607_10107@_flv_module --with-@R_607_10107@_gunzip_module --with-@R_607_10107@_gzip_static_module --with-@R_607_10107@_mp4_module --with-@R_607_10107@_random_index_module --with-@R_607_10107@_realip_module --with-@R_607_10107@_secure_link_module --with-@R_607_10107@_slice_module --with-@R_607_10107@_ssl_module --with-@R_607_10107@_stub_status_module --with-@R_607_10107@_sub_module --with-@R_607_10107@_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_sourcE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,Now -pie' # 如果企业之前的 Nginx 都是通过源码安装,只需要通过 Nginx -v -V,就能知道版本及编译选项,安装时: ./configure --prefix=/etc/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 --@R_607_10107@-log-path=/var/log/Nginx/access.log --pid-path=/var/run/Nginx.pid --lock-path=/var/run/Nginx.lock --@R_607_10107@-client-body-temp-path=/var/cache/Nginx/client_temp --@R_607_10107@-proxy-temp-path=/var/cache/Nginx/proxy_temp --@R_607_10107@-fastcgi-temp-path=/var/cache/Nginx/fastcgi_temp --@R_607_10107@-uwsgi-temp-path=/var/cache/Nginx/uwsgi_temp --@R_607_10107@-scgi-temp-path=/var/cache/Nginx/scgi_temp --user=Nginx --group=Nginx --with-compat --with-file-aio --with-threads --with-@R_607_10107@_addition_module --with-@R_607_10107@_auth_request_module --with-@R_607_10107@_dav_module --with-@R_607_10107@_flv_module --with-@R_607_10107@_gunzip_module --with-@R_607_10107@_gzip_static_module --with-@R_607_10107@_mp4_module --with-@R_607_10107@_random_index_module --with-@R_607_10107@_realip_module --with-@R_607_10107@_secure_link_module --with-@R_607_10107@_slice_module --with-@R_607_10107@_ssl_module --with-@R_607_10107@_stub_status_module --with-@R_607_10107@_sub_module --with-@R_607_10107@_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_sourcE=2 -fexceptions -fstack-protector-strong 便宜香港vps --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,Now -pie' 问题二:选项那么多,必须要配吗?网上搜的博文中选项没那么长 答:选项是根据企业需求来定制,最好按官方的或者企业模板来实现
-
了解Nginx软件的全貌
# 查看整体的目录结构及对应的功能 rpm -ql Nginx
Nginx安装目录
路径 | 类型 | 作用 |
---|---|---|
/etc/Nginx | 配置文件 | Nginx主配置文件 |
/etc/Nginx/Nginx.conf | 配置文件 | Nginx主配置文件 |
/etc/Nginx/conf.d | 配置文件 | Nginx主配置文件 |
/etc/Nginx/conf.d/default.conf | 配置文件 | Nginx主配置文件 |
/etc/Nginx/fastcgi_params | 配置文件 | Cgi、Fastcgi、Uwcgi 配置文件 |
/etc/Nginx/scgi_params | 配置文件 | Cgi、Fastcgi、Uwcgi 配置文件 |
/etc/Nginx/uwsgi_params | 配置文件 | Cgi、Fastcgi、Uwcgi 配置文件 |
/etc/Nginx/win-utf | 配置文件 | Nginx编码转换映射文件 |
/etc/Nginx/koi-utf | 配置文件 | Nginx编码转换映射文件 |
/etc/Nginx/koi-win | 配置文件 | Nginx编码转换映射文件 |
/etc/Nginx/mime.types | 配置文件 | @R_607_10107@协议的Content-Type与扩展名 |
/usr/lib/systemd/system/Nginx.service | 配置文件 | 配置系统守护进程管理器 |
/etc/logrotate.d/Nginx | 配置文件 | Nginx日志轮询,日志切割 |
/usr/sbin/Nginx | 命令 | Nginx 终端管理命令 |
/usr/sbin/Nginx-debug | 命令 | Nginx 终端管理命令 |
/etc/Nginx/modules | 目录 | Nginx模块目录 |
/usr/lib64/Nginx | 目录 | Nginx模块目录 |
/usr/lib64/Nginx/modules | 目录 | Nginx模块目录 |
/usr/share/Nginx | 目录 | Nginx默认站点目录 |
/usr/share/Nginx/html | 目录 | Nginx默认站点目录 |
/usr/share/Nginx/html/50x.html | 目录 | Nginx默认站点目录 |
/usr/share/Nginx/html/index.html | 目录 | Nginx默认站点目录 |
/usr/share/doc/Nginx-1.16.1 | 目录 | Nginx的帮助手册 |
/usr/share/man/man8/Nginx.8.gz | 目录 | Nginx的帮助手册 |
/var/cache/Nginx | 目录 | Nginx的缓存目录 |
/var/log/Nginx | 目录 | Nginx的日志目录 |
/etc/logrotate.d/Nginx
@H_673_6@
/usr/sbin/Nginx
@H_673_6@
/usr/lib/systemd/system/Nginx.service
@H_673_6@
本站总结
以上是本站教程为你收集整理的nginx学习三:nginx安装全部内容,希望文章能够帮你解决nginx学习三:nginx安装所遇到的程序开发问题。
如果觉得本站教程网站内容还不错,欢迎将本站教程推荐给好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。