这篇文章将为大家详细讲解有关LNMP架构中Nginx服务配置文件的示例分析,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
1、Nginx服务目录结构介绍
[root@centos6 application]# tree Nginx
+-- client_body_temp
¦ +-- fastcgi.conf #fastcgi配置文件
¦ +-- fastcgi.conf.default
¦ +-- fastcgi_params #fastcgi参数配置文件
¦ +-- fastcgi_params.default
¦ +-- koi-utf
¦ +-- koi-win
¦ +-- mime.types
¦ +-- mime.types.default
¦ +-- Nginx.conf #Nginx服务的主配置文件
¦ +-- Nginx.conf.default #Nginx服务的默认配置文件
¦ +-- scgi_params
¦ +-- scgi_params.default
¦ +-- win-utf
+-- fastcgi_temp
+-- html #编译安装Nginx默认的首页配置文件目录
¦ +-- index.html.bak
+-- logs #日志配置文件目录
¦ +-- access.log #访问日志文件
+-- proxy_temp
+-- sbin #命令目录
+-- scgi_temp #临时目录
+-- uwsgi_temp
[root@centos6 conf]# egrep -v "#|^$" Nginx.conf
worker_processes 1; #工作进程数
events { #事件
worker_connections 1024; #并发数,单位时间内最大连接数
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server { #虚拟主机标签
listen 80; #监听的端口号
server_name localhost; #服务器主机名
location / {
index index.html index.htm; #默认首页文件
}
error_page 500 502 503 504 /50x.html; #错误页面文件
location = /50x.html {
root html;
}
}
}
3、Nginx服务帮助信息
[root@centos6 conf]# /application/Nginx/sbin/Nginx -h
Nginx version: Nginx/1.10.1 #版本信息
Usage: Nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
#检查配置(检查语法)
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /application/Nginx-1.10.1/)
-c filename : set configuration file (default: conf/Nginx.conf)
-g directives : set global directives out of configuration file
4、Nginx编译参数查看
[root@centos6 conf]# /application/Nginx/sbin/Nginx -v
[root@centos6 conf]# /application/Nginx/sbin/Nginx -V
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments:
--user=Nginx
--group=Nginx
--prefix=/application/Nginx-1.10.1
--with-http_stub_status_module
--with-http_ssl_module
-with-pcre=/download/tools/pcre-8.38
实际生产环境比较实用的查看参数,比如服务非你自己所安装,但又没有相关文档参考,此参数可以提供一些相关的信息
关于“LNMP架构中Nginx服务配置文件的示例分析”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。