了解Nginx安装目录的作用 3.17

  • 2018-03-16
  • 154
  • 1
  • 0

编译安装不太适合我这样的新手,还是选择用yum更好!

直接rm -rf 掉/usr/local/scr/nginx和/usr/local/nginx两个文件夹.

官方安装教程:http://nginx.org/en/linux_packages.html#stable

新建一个nginx的repo源:

# vim /etc/yum.repos.d/nginx.repo

从网址内获取源配置内容:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

取决于所使用的系统,将“OS”替换为“rhel”或“centos”,将“OSRELEASE”替换为分别为“6”或“7”。

执行yum list |grep nginx ,已经有最新版nginx了,红色的字母即刚才添加的源.

#yum install nginx 安装nginx

为什么不要源码安装,因为yum安装更加高效!!!

Verifying  : 1:nginx-1.12.2-1.el7_4.ngx.x86_64                                    1/1 

Installed:
  nginx.x86_64 1:1.12.2-1.el7_4.ngx                                                     

Complete!

[root@iZufzjhnxq local]# nginx -v #查看版本号
nginx version: nginx/1.12.2

[root@iZufzjhnxq local]# nginx -V #查看编译参数

最爽的就是看见Complete啦,另外上面的命令都运行成功,就表示安装成功啦!


了解安装目录

#rpm -ql nginx #列出nginx的rpm包安装的配置文件目录

/etc/logrotate.d/nginx
/etc/nginx
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
/etc/nginx/fastcgi_params
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/modules
/etc/nginx/nginx.conf
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
/etc/nginx/win-utf
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
/usr/lib64/nginx
/usr/lib64/nginx/modules
/usr/libexec/initscripts/legacy-actions/nginx
/usr/libexec/initscripts/legacy-actions/nginx/check-reload
/usr/libexec/initscripts/legacy-actions/nginx/upgrade
/usr/sbin/nginx
/usr/sbin/nginx-debug
/usr/share/doc/nginx-1.12.2
/usr/share/doc/nginx-1.12.2/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/var/cache/nginx
/var/log/nginx

/etc/logrotate.d/nginx  配置文件 Nginx日志轮转,用于logrotare服务的日志切割
/etc/nginx
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf #安装后默认加载的配置文件
/etc/nginx/nginx.conf
上面四个是nginx主要配置文件/目录
/etc/nginx/fastcgi_params
/etc/nginx/scgi_params
/etc/nginx/uwsgi_params
cgi配置相关,fastcgi配置
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/win-utf
用于编码转换的配置文件
/etc/nginx/mime.types 设置http协议的Content-Type与扩展名对应关系
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
用于配置出系统守护进程管理器管理方式
/etc/nginx/modules
/usr/lib64/nginx/modules
nginx模块目录
/usr/sbin/nginx
/usr/sbin/nginx-debug #nginx服务的启动管理的终端命令
/usr/share/doc/nginx-1.12.2
/usr/share/doc/nginx-1.12.2/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
nginx的手册和帮助文件
/var/log/nginx #nginx的日志目录

.

.

.

2018.3.16睡觉,明天继续

今天了解一下 nginx -V 的配置参数

# nginx -V
nginx version: nginx/1.12.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (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 --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_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'

 

安装目的的目录和路径:

--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  错误日志
--http-log-path=/var/log/nginx/access.log  访问日志
--pid-path=/var/run/nginx.pid              pid文件
--lock-path=/var/run/nginx.lock

 

执行对应模块时,Nginx所保留的临时性文件:

--http-client-body-temp-path=/var/cache/nginx/client_temp 
--http-proxy-temp-path=/var/cache/nginx/proxy_temp 
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp 
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp 
--http-scgi-temp-path=/var/cache/nginx/scgi_temp

设定Nginx进程启动的用户和用户组:

--user=nginx 
--group=nginx

3.17今天去吃纸包鱼了

 

  1. 2017:  C语言做个小游戏 弹球游戏哦(2)
  2. 2017:  敖厂长‘被人威胁’事件全过程(0)

评论

发表评论