How to install nginx,php and laravel on centos6.9? - nginx

I have purchased godaddy vps server and on that I want to install nginx,laravel and php.
I was trying to install nginx I am getting issue:
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
1. List item
2017/11/21 03:52:00 [emerg] 23590#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

You should check if SELinux is off.
Updated:
Please disable SELinux as guide here:
https://www.tecmint.com/disable-selinux-temporarily-permanently-in-centos-rhel-fedora/
To save your time, please try below command:
setenforce 0
Then try your work again.

Related

Problem with brotli configuration in nginx

I am following this guide https://www.vultr.com/docs/add-brotli-support-to-nginx-on-ubuntu-18-04
I have followed every step but I am stuck at Step 4 – Configure Nginx
When I add to nginx.conf
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
I get this error after running sudo nginx -t:
nginx: [emerg] dlopen() "/usr/share/nginx/modules/ngx_http_brotli_filter_module.so" failed (/usr/share/nginx/modules/ngx_http_brotli_filter_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/nginx.conf:6
nginx: configuration file /etc/nginx/nginx.conf test failed
What might cause that?
Thank you!
Hosting provider: DigitalOcean
Server running: Ubuntu 20.04 LEMP
Nginx version: 1.17.10
I had the same issue 2 years back and after a lot of reading and research got it working.
Hope this helps.
I have provided step by step instruction in the answer.
ngx_http_brotli_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf:1

Let's encrypt certification does not work for nginx on ubuntu

I am getting the following error when running sudo certbot-auto --nginx. I followed the instructions in this website https://certbot.eff.org/lets-encrypt/ubuntuother-nginx using nginx and Ubuntu 14
/opt/eff.org/certbot/venv/local/lib/python2.7/site-
packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.
utils.PersistentlyDeprecated2018,
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem")
failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] BIO_new_file("/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(\'/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem\',\'r\') error:2006D080:BIO routines:BIO_new_file:no such file)\nnginx: configuration file /etc/nginx/nginx.conf test failed\n',)
I also do not understand the python warning since
python --version
Python 3.6.3
but for any reason it uses python 2
Also it might be useful to know that there are no certicates available right now
sudo /usr/local/bin/certbot-auto --nginx
/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.
utils.PersistentlyDeprecated2018,
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
nginx: [emerg] BIO_new_file("/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] BIO_new_file("/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(\'/etc/letsencrypt/live/www.benty-fields.com/fullchain.pem\',\'r\') error:2006D080:BIO routines:BIO_new_file:no such file)\nnginx: configuration file /etc/nginx/nginx.conf test failed\n',)
I fixed it...
one has to remove the certbot links in a few files which can be found with
grep -R /etc/letsencrypt/live/example.com/fullchain.pem /etc/nginx/

NGINX cannot create it's own .conf file on Windows 10

When I cd into the nginx folder as an admin in CMD, and run nginx.exe, it fails to create its config file. I have tried a local vs a online account and different versions of nginx.
The error message is:
nginx: [emerg] CreateFile() "c:\nginx\conf\nginx.conf" failed (2: FormatMessage() error:(15100))

Datadog integration with NGiNX

I am new to Datadog and NGiNX. I noticed when I was creating a monitor for some integrations several of the integrations were labeled as misconfigured. My guess is someone clicked the install button but did finish the remaining integration steps. I started to work with NGiNX and quickly hit a roadblock.
I verified it is running http status module
$ nginx -V 2>&1| grep -o http_stub_status_module
http_stub_status_module
The NGiNX install is under a different directory than is usual
and the configuration file is under
/<dir>/parts/nginx/conf
I created the status.conf file there.
When I reload the NGINX I get a failure. I don't understand what it means or how to proceed from here.
nginx: [error] open() "/<dir>/parts/nginx/logs/nginx.pid" failed (2: No such file or directory)
There is a logs directory with nothing in it.
ps -ef|grep nginx
user 35958 88952 0 May24 ? 00:00:43 nginx: worker process
user 35959 88952 0 May24 ? 00:00:48 nginx: worker process
root 88952 1 0 Feb21 ? 00:00:00 nginx: master process <dir>/parts/nginx/sbin/nginx -c <dir>/etc/nginx/balancer.conf -g pid <dir>/var/nginx-balancer.pid; lock_file /<dir>/var/nginx-balancer.lock; error_log <dir>/var/logs/nginx-balancer-error.log;
user 109169 63043 0 13:13 pts/0 00:00:00 grep --color=auto nginx
I think the issue is that our install doesn't seem to be following the same defaults as the instructions and I'm pretty sure I'm not doing this correctly.
If anyone has any insights that would be great!
Chris

specify server root as a parameter when launching nginx

I've put nginx into /d/webservers/nginx on Windows and added it to the PATH. Now I try to run nginx from different folder but get the following error:
nginx: [alert] could not open error log file: CreateFile() "logs/error.log" failed (3: The system cannot find the path specified)
2015/03/22 10:09:25 [emerg] 5516#3056: CreateFile() "C:\Users\username/conf/nginx.conf" failed (3: The system cannot find the path specified)
It seems that nginx can't find it's server root folder /d/webservers/nginx where config and logs folder exists. Is there any way to pass as an argument the pass to the server root folder? Something like it's done for Apache: httpd -d /d/Webservers/Apache24'
nginx -c d:/webservers/nginx/conf/nginx.conf

Resources