nginx的基本參數(shù)使用(4)

獲取全套nginx教程,請訪問瓦力博客

記錄nginx安裝完成后,在不同的目錄下面的文件的作用

1.安裝目錄

在上一節(jié)中安裝了nginx,使用

rpm -ql nginx

就能查看nginx安裝完后都在哪些目錄下。

路徑 類型 作用
/etc/logrotate.d/nginx 配置文件 Nginx日志輪轉(zhuǎn),用于logrotate服務(wù)的日志切割
/etc/nginx
/etc/nginx/nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf
目錄、配置文件 Nginx主配置文件
/etc/nginx/fastcgi_params
/etc/nginx/uwsgi_params
/etc/nginx/scgi_params
配置文件 cgi配置相關(guān),fastcgi配置
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/win-utf
配置文件 編碼轉(zhuǎn)換映射轉(zhuǎn)化文件
/etc/nginx/mime.types 配置文件 設(shè)置http協(xié)議的Content-Type與擴(kuò)展名對應(yīng)關(guān)系
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service
/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
配置文件 用于配置出系統(tǒng)守護(hù)進(jìn)程管理器管理方式
/usr/lib/nginx/modules
/etc/nginx/modules
目錄 Nginx模塊目錄
/usr/sbin/nginx
/usr/sbin/nginx-debug
命令 Nginx服務(wù)的啟動管理的終端命令
/usr/share/doc/nginx-1.12.0
/usr/share/doc/nginx-1.12.0/COPYRIGHT
/usr/share/man/man8/nginx.8.gz
文件目錄 Nginx的手冊和幫助文件
/var/cache/nginx 目錄 Nginx的緩存目錄
/var/log/nginx 目錄 Nginx的日志目錄

2.安裝編譯參數(shù)

查看之前安裝nginx參數(shù)

nginx -V
編譯選項 作用
--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
執(zhí)行對應(yīng)模塊時Nginx所保留的臨時性文件
--user=nginx
--group=nginx
設(shè)定Nginx進(jìn)程啟動的用戶和用戶組
--with-cc-opt=parameters 設(shè)置而外地參數(shù)將被添加到CFLAGS變量
--with-Id-opt=parameters 設(shè)置附加的按時,鏈接系統(tǒng)庫

3.Nginx默認(rèn)語法配置

語法 描述
user 設(shè)置nginx服務(wù)的系統(tǒng)使用用戶
worker_processes 工作進(jìn)程數(shù)
error_log nginx的錯誤日志
pid nginx服務(wù)啟動時候pid
類型 語法 描述
events worker_connections 每個進(jìn)程允許最大連接數(shù)
events use 工作進(jìn)程數(shù)

http模塊

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容