Nginx Doesn't Work After Compiling from Source and Installing - nginx

I've compiled and installed nginx from source with three easy commands:
./configure
make
sudo make install
Now when I try to run nginx under my default user, I get this message:
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
It also doesn't work with sudo with a pretty strange error:
sudo: nginx: command not found
So does anybody know: What can I do in this situation?

Add /usr/local/nginx/sbin to your PATH variable in /etc/environment.

Related

Error after compile ngx_pagespeed.so module nginx version 1.22.1

Would it be worth to put nginx http2, varnish, ngx_pagespeed module, redis all combined?
I have this doubt, yesterday I tried to install ngx_pagespeed on my server but it gave me an error in console after compile:
sudo nginx -t
nginx: [emerg] dlopen() "/usr/lib/nginx/modules/ngx_pagespeed.so" failed (/usr/lib/nginx/modules/ngx_pagespeed.so: undefined symbol: pthread_mutex_consistent_np) in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
I'm using nginx 1.22.1, http2, varnish and redis, gzip, brotli, maybe my nginx version is not supported with this module.

nginx: [emerg] unknown "root" variable

I am using easyengine and suddenly nginx is not reloading. I went to the log and nginx -t, its saying nginx: [emerg] unknown "root" variable and it failed to test. My sites are down. Is there anyone to help?

Nginx permissions issue: www-data user can't open error log despite 766 permissions

I have an Ubuntu 14.04 server where nginx was originally installed by the root user. I now want to run nginx as a non-root user, a new user that I added to both the sudo the www-data groups. For now, I have yet to install an app server.
When I try to run nginx from this new user, I get the following message:
nginx: [alert] could not open error log file: open()
"/var/log/nginx/error.log" failed (13: Permission denied) 2016/08/09
22:07:52 [warn] 17609#0: the "user" directive makes sense only if the
master process runs with super-user privileges, ignored in
/etc/nginx/nginx.conf:1 2016/08/09 22:07:52 [emerg] 17609#0: open()
"/var/log/nginx/access.log" failed (13: Permission denied)
I'm confused why this is an issue — I changed the owner and group of /var/log/nginx/ to www-data. The nginx master process user is root, which I believe is correct, and the sub-processes are running (or trying to run) as www-data. The file permissions for error.log and access.log are 766. What am I missing?
You probably started
nginx -t
as a normal user. Then you get exactly that misleading error message
if you do it as root or with sudo the error should be gone

I cannot connect with the server ngnix: Unable to connect

I dont get any error message in
/var/log/nginx/error.log
I make sudo service nginx restart OK
My code in /etc/nginx/nginx.conf is => https://codeshare.io/q9Nr3
My code in /etc/nginx/sites-available/default is => https://codeshare.io/Rm7wP
When I executed my code in nginx -s reload
miguel#127:/$ nginx -s reload
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2016/01/29 21:02:32 [warn] 3471#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
2016/01/29 21:02:32 [notice] 3471#0: signal process started
2016/01/29 21:02:32 [alert] 3471#0: kill(1154, 1) failed (1: Operation not permitted)
I put in my terminal sudo chmod -R 755 /var/log/nginx, but I dont get permissions

nginx unknown directive health_check

I am new to nginx. I am using -
health_check uri=/some/uri
but on running the test with this command -
sudo /usr/sbin/nginx -t -c /etc/nginx/nginx.conf
I get the following error -
nginx: [emerg] unknown directive "health_check" in /etc/nginx/sites-enabled/abc.conf:121
Can someone tell what is wrong here..? I have used apache2 to do all jing-bang but I do not have much knowledge about nginx..
According to Nginx docs :
This directive is available as part of nginx commercial subscription.

Resources