Centos

在 Nginx 自定義建構 Centos 7 中未創建 Pid 和 Lock 文件

  • October 13, 2014

我正在嘗試從原始碼安裝 nginx。之後make install,我查看了/var/run/文件夾,但在那裡找不到nginx.pid文件和nginx.lock文件。這是我的配置:

sudo ./configure --add-module=/opt/nginx-compile/modules/ngx_pagespeed-release-1.9.32.1-beta \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--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 \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--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_stub_status_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-ipv6 \
--with-http_spdy_module \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--user=nginx \
--group=nginx

sudo make
sudo make install

在上面的命令之後,不應該有一個新的nginx.pidnginx.lock文件創建在/var/run/?我在那裡看不到他們。

這是我之後看到的確認make install

make -f objs/Makefile install
make[1]: Entering directory `/opt/nginx-compile/nginx-1.6.1'
test -d '/etc/nginx' || mkdir -p '/etc/nginx'
test -d '/usr/sbin'             || mkdir -p '/usr/sbin'
test ! -f '/usr/sbin/nginx'             || mv '/usr/sbin/nginx'                         '/usr/sbin/nginx.old'
cp objs/nginx '/usr/sbin/nginx'
test -d '/etc/nginx'            || mkdir -p '/etc/nginx'
cp conf/koi-win '/etc/nginx'
cp conf/koi-utf '/etc/nginx'
cp conf/win-utf '/etc/nginx'
test -f '/etc/nginx/mime.types'                 || cp conf/mime.types '/etc/nginx'
cp conf/mime.types '/etc/nginx/mime.types.default'
test -f '/etc/nginx/fastcgi_params'             || cp conf/fastcgi_params '/etc/nginx'
cp conf/fastcgi_params          '/etc/nginx/fastcgi_params.default'
test -f '/etc/nginx/fastcgi.conf'               || cp conf/fastcgi.conf '/etc/nginx'
cp conf/fastcgi.conf '/etc/nginx/fastcgi.conf.default'
test -f '/etc/nginx/uwsgi_params'               || cp conf/uwsgi_params '/etc/nginx'
cp conf/uwsgi_params            '/etc/nginx/uwsgi_params.default'
test -f '/etc/nginx/scgi_params'                || cp conf/scgi_params '/etc/nginx'
cp conf/scgi_params             '/etc/nginx/scgi_params.default'
test -f '/etc/nginx/nginx.conf'                 || cp conf/nginx.conf '/etc/nginx/nginx.conf'
cp conf/nginx.conf '/etc/nginx/nginx.conf.default'
test -d '/var/run'              || mkdir -p '/var/run'
test -d '/var/log/nginx' ||             mkdir -p '/var/log/nginx'
test -d '/etc/nginx/html'               || cp -R html '/etc/nginx'
test -d '/var/log/nginx' ||             mkdir -p '/var/log/nginx'
make[1]: Leaving directory `/opt/nginx-compile/nginx-1.6.1'

通常,pid 或鎖定文件是在啟動應用程序時創建的,而不僅僅是通過建構應用程序。

make install輸出中可以看出,這僅確定基目錄/var/run在那裡。

引用自:https://serverfault.com/questions/636728