When I am executing this command:
./nginx -s reload
Throw error:
nginx: [alert] kill(57200, 1) failed (3: No such process)
when I open the nginx.pid file:
vim /usr/loca/nginx/logs/nginx.pid
the process id is:57200.But when I am checking nginx process,it does not have master process,the output is:
[root#localhost logs]# ps -aux|grep nginx
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 12191 0.0 0.0 28172 8956 ? S Aug29 3:54 nginx: worker process
root 12192 0.0 0.0 28172 8960 ? S Aug29 3:53 nginx: worker process
root 12193 0.0 0.0 28436 9272 ? S Aug29 3:46 nginx: worker process
root 12194 0.0 0.0 28172 8948 ? S Aug29 3:55 nginx: worker process
root 12195 0.0 0.0 28436 9156 ? S Aug29 3:56 nginx: worker process
root 12196 0.0 0.0 28172 8944 ? S Aug29 3:49 nginx: worker process
root 12197 0.0 0.0 28172 8988 ? S Aug29 3:58 nginx: worker process
root 12198 0.0 0.0 27908 8740 ? S Aug29 3:42 nginx: worker process
root 12199 0.0 0.0 27908 8744 ? S Aug29 3:39 nginx: worker process
root 53760 0.0 0.0 103252 832 pts/1 S+ 22:14 0:00 grep nginx
root 80835 0.0 0.0 27908 8740 ? S Aug31 2:30 nginx: worker process
What's wrong? How to solve this problem? The nginx version is 1.10.2.
I also faced similar issue on nginx 1.10.2.
Instead of ./nginx -s reload, I used ./nginx to start nginx and it solved this issue.
Related
When i run my nginx server with command:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
I have two master process
root 11632 2.6 0.1 76164 1372 ? Ss 01:30 0:06 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
www 14515 3.0 24.0 319920 245060 ? S 01:35 0:00 nginx: worker process
www 14516 3.0 24.0 319920 245060 ? S 01:35 0:00 nginx: worker process
www 14517 3.0 24.0 319920 245232 ? S 01:35 0:00 nginx: worker process
www 14518 0.0 6.5 319920 66544 ? R 01:35 0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
A part of my nginx.conf:
user www www;
worker_processes 4;
error_log /data/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 600000;
events
{
use epoll;
worker_connections 600000;
}
When worker_processes less than 4, the ps aux | grep nginx | grep -v grep looks good. If worker_process is 4, it will have two master processes.
So, I'm still newbie for all Unix stuff and now I face a problem which make me mad :) I also asking my friend, more experienced programmer, but he cant find answer too.
So, I trying to start zf2 application based on zend-skeleton with nginx and php5-fpm.
$ sudo service nginx status
* nginx is running
$ sudo service php5-fpm status
php5-fpm start/running, process 3389
$ ps aux | grep php
root 3389 0.0 0.3 145520 13624 ? Ss 15:40 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 3392 0.0 0.1 145520 4968 ? S 15:40 0:00 php-fpm: pool www
www-data 3393 0.0 0.1 145520 5324 ? S 15:40 0:00 php-fpm: pool www
somebud+ 3551 0.0 0.0 5908 840 pts/1 S+ 15:55 0:00 grep --color=auto php
$ ps aux | grep nginx
somebud+ 3172 0.5 0.6 184412 24944 ? Sl 15:33 0:07 gedit /etc/nginx/nginx.conf
root 3368 0.0 0.0 15196 1092 ? Ss 15:40 0:00 nginx: master process /usr/sbin/nginx
www-data 3369 0.0 0.0 15720 2080 ? S 15:40 0:00 nginx: worker process
www-data 3370 0.0 0.0 15376 1516 ? S 15:40 0:00 nginx: worker process
www-data 3371 0.0 0.0 15376 1516 ? S 15:40 0:00 nginx: worker process
www-data 3372 0.0 0.0 15376 1516 ? S 15:40 0:00 nginx: worker process
somebud+ 3554 0.0 0.0 5908 840 pts/1 S+ 15:55 0:00 grep --color=auto nginx
This is my /etc/nginx/sites-available/testing.dom
server {
listen 80;
server_name testing.dom;
root /var/www/testing.dom/public_html/CommunicationApp/public/;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ .*\.(php|phtml)?$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param APPLICATION_ENV development;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
location ~ .*\.(git|jpg|jpeg|png|bmp|swf|ico)?$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1h;
}
location ~ /\.ht {
deny all;
}
}
My include_path is in the /etc/php5/fpm/php.ini like this:
; UNIX: "/path1:/path2"
include_path = ".:/usr/share/php:/var/www/testing.dom/public_html/library/Zend"
This is what in this Zend folder:
$ sudo ls /var/www/testing.dom/public_html/library/Zend/
Authentication Code Db Escaper Filter InputFilter Log Mime Paginator Server Stdlib Uri XmlRpc
Barcode Config Debug EventManager Form Json Mail ModuleManager Permissions ServiceManager Tag Validator
Cache Console Di Feed Http Ldap Math Mvc ProgressBar Session Test Version
Captcha Crypt Dom File I18n Loader Memory Navigation Serializer Soap Text View
Is this right library folder?
And this is my /var/www/testing.dom/public_html/CommunicationApp/public/index.php
chdir(dirname(__DIR__));
$temp = get_include_path();
var_dump($temp);
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
}
// Setup autoloading
require '../CommunicationApp/init_autoloader.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
So, if I enter testing.dom in browser I got still this:
string(62) ".:/usr/share/php:/var/www/testing.dom/public_html/library/Zend"
And nothing else.
And this is nginx error.log:
2014/10/17 16:11:29 [error] 3369#0: *8 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.' in /var/www/testing.dom/public_html/CommunicationApp/init_autoloader.php:53
Stack trace:
#0 /var/www/testing.dom/public_html/CommunicationApp/public/index.php(17): require()
#1 {main}
thrown in /var/www/testing.dom/public_html/CommunicationApp/init_autoloader.php on line 53" while reading response header from upstream, client: 127.0.0.1, server: testing.dom, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "testing.dom"
Problem was solved! If you got such headache try to define your ZF2_PATH in fastcgi_params like this:
fastcgi_param ZF2_PATH /var/www/testing.dom/public_html/library/;
I'm serving some demos in isolation like:
/demo1/-- nginx.conf
|- index.html
|- ...
#run
/demo1$ sudo nginx -c `pwd`/nginx.conf
and
/demo2/-- nginx.conf
|- index.html
|- ...
#run
/demo2$ sudo nginx -c `pwd`/nginx.conf
now I have the following nginx processes:
$ ps aux | grep nginx
root 3434 0.0 0.0 85904 1340 ? Ss 12:02 0:00 nginx: master process nginx -c /demo1/nginx.conf
nobody 3435 0.0 0.0 86316 2272 ? S 12:02 0:00 nginx: worker process
root 5096 0.0 0.0 85904 1344 ? Ss 11:21 0:00 nginx: master process nginx -c /demo2/nginx.conf
nobody 5097 0.0 0.0 86316 2272 ? S 11:21 0:00 nginx: worker process
I believe (tell me if I'm wrong) that if I reload the configuration this way:
$ sudo nginx -s reload
It will only deliver the message to the last master process that was spun.
How do I reload the configuration on a specific master process?
After reading the manpage I believe it has some to do with the -g option but I'm not sure how. Should I specify a static PID or something?
Here is my nginx.conf for reference
user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
server {
listen 8000;
location / {
root /demoX;
index index.html index.htm;
}
}
}
You can use a signal to certain PID:
kill -QUIT 3434
Reload option is a reference to QUIT signal which reloads the config and spawn new worker.
I'm confused
2014/05/12 09:36:51 [error] 25928#0: *1 open() "/home/dev/OpenWrt-ImageBuilder-brcm47xx-for-linux-x86_64/packages/test.html" failed (13: Permission denied), client: 128.68.154.57, server: localhost, request: "GET /test.html HTTP/1.1"
here is permissions
[root#vsfedora OpenWrt-ImageBuilder-brcm47xx-for-linux-x86_64]# namei -l /home/dev/OpenWrt-ImageBuilder-brcm47xx-for-linux-x86_64/packages/test.html
f: /home/dev/OpenWrt-ImageBuilder-brcm47xx-for-linux-x86_64/packages/test.html
dr-xr-xr-x root root /
drwxr-xr-x root root home
drwxrwx--- dev dev dev
drwxr-xr-x dev dev OpenWrt-ImageBuilder-brcm47xx-for-linux-x86_64
drwxr-xr-x dev dev packages
-rw-rw-r-- dev dev test.html
here is group
dev:x:1000:nginx
nginx worker process working as nginx user
[root#vsfedora ~]# ps aux|grep nginx
root 26494 0.0 0.3 111588 3796 ? Ss 11:07 0:00 nginx: master process /usr/sbin/nginx
nginx 26495 0.0 0.5 111932 5116 ? S 11:07 0:00 nginx: worker process
server section in nginx.conf:
server {
location / {
autoindex on;
root /usr/share/nginx/html;
}
symlink is also fine
lrwxrwxrwx. 1 0 0 65 May 12 10:10 packages -> /home/dev/OpenWrt-ImageBuilder-brcm47xx-for-linux-x86_64/packages
it's a SELinux issue
tail /var/log/audit/audit.log
type=AVC msg=audit(1399879586.183:2081199): avc: denied { search } for pid=26495 comm="nginx" name="dev" dev="dm-1" ino=269277 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir
type=SYSCALL msg=audit(1399879586.183:2081199): arch=c000003e syscall=2 success=no exit=-13 a0=7fdd65ed2219 a1=800 a2=0 a3=0 items=0 ppid=26494 pid=26495 auid=4294967295 uid=996 gid=1000 euid=996 suid=996 fsuid=996 egid=1000 sgid=1000 fsgid=1000 ses=4294967295 tty=(none) comm="nginx" exe="/usr/sbin/nginx" subj=system_u:system_r:httpd_t:s0 key=(null)
detailed explanation and resolution can be found here
Per documentation on user directive, nginx uses group name equal to user name if you omit group name. So you have to explicitly use user nginx dev; in your nginx.conf.
I have been at this for days now. I think I am simply too stupid. Please help.
I have redmine + gitolite 2.3-1 setup on nginx 1.2.1-2.2+wheezy1 (please find more details under (2) Both services are running on the same machine. The rake commands where run with user and group redmine. nginx however is running as www-data user. User
git#raspberrypi:/usr/share/redmine$ id redmine
uid=110(redmine) gid=113(redmine) groups=113(redmine),33(www-data),112(git)
My raspberry is behind a NAT, ports are forwarded correctly, ssh access works to user git, who is also running gitolite.
The repo that I want to use for my project was setup with redmine, which worked fine. Now redmine tells me ssh, http and https links to the repo to use for cloning and pushing etc.
Clone Repository :
git clone ssh://git#<myURL>.org/<myProjectName>-gitolite.git
Now when I try cloning the repo I get the famous message:
$ git clone git#<myURL>.org:<myProjectName>-gitolite.git
Cloning into '<myProjectName>-gitolite'...
fatal: '<myProjectName>-gitolite.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have cloned the repo locally, there it shows that redmine has inserted the deployment keys just fine:
repo <myProjectName>-gitolite
RW+ = redmine__deploy_key__1385587228_1212 redmine__deploy_key_...
I am really lost here, please help. I give you more information if needed, because, as you can see from the long text I don't understand the setup too well as well. It is too complicated, I think.
Redmine tells me also that I could use http and https checkouts, but a netstat reveals that there is no server listening on 443.
I am exhausted now, please help.
(2) I have the following system:
Linux raspberrypi 3.6.11-rpi-aufs ... armv6l GNU/Linux
Redmine: svn checkout URL: http://redmine.rubyforge.org/svn/branches/2.3-stable
plugins: plugins/redmine_git_hosting/
plugins/redmine_plugin_views_revisions/
I am using nginx to access redmine, currently via http.
git#raspberrypi:/usr/share/redmine$ ps aux |grep nginx
root 2796 0.0 0.1 11544 828 ? Ss Nov27 0:00 nginx: master process /usr/sbin/nginx
www-data 2798 0.0 0.3 12016 1448 ? S Nov27 0:03 nginx: worker process
www-data 2799 0.0 0.2 11704 1152 ? S Nov27 0:03 nginx: worker process
www-data 2800 0.0 0.3 12028 1768 ? S Nov27 0:00 nginx: worker process
www-data 2801 0.0 0.2 12028 1392 ? S Nov27 0:03 nginx: worker process