I am trying to install nginx on a rhel 7 and it says process doesn't start. Following is the log.
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Starting nginx -
high performance web server...**
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: the
configuration file /etc/nginx/nginx.conf syntax is ok
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: [emerg]
open() "/mnt/nginx_logs/pubstore/access.log" failed (13: Permission
denied)
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx:
configuration file /etc/nginx/nginx.conf test failed
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: nginx.service:
control process exited, code=exited status=1
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Failed to start
nginx - high performance web server.
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal systemd[1]: Unit
nginx.service entered failed state.**
The permission of the file access log is as follows. I have given permission but still it doesn't start.
-rwxrwxrwx. 1 nginx nginx 0 Nov 13 02:07 access.log
-rwxrwxrwx. 1 nginx nginx 0 Nov 13 02:07 error.log
The installation is done on a puppet agent on amazon ec2 instance
This line:
Nov 13 06:36:42 ip-10-0-0-10.ec2.internal nginx[30974]: nginx: [emerg] open() "/mnt/nginx_logs/pubstore/access.log" failed (13: Permission denied)
Tells you that the user you are running nginx as, does not have access to write to the log file its configured to write to.
Since the logs are being stored in a non-standard location, you will likely have to ensure that the directory you want to store logs in, is writable by the same user that nginx is running as.
Related
I have developed application which has NuxtJS front-end and Node + Express back-end as component. The front-end running in 3000 & back-end on 5000. I installed Nginx on my EC2 instance and copied all both folder separately. I following this tutorial, im on the step to "Setup Nginx Reverse Proxy".
enter image description here
enter image description here
Here is my /etc/nginx/sites-enabled/ file. I added following part in that file when (create a symbolic link to it in sites-enabled). But its not working.
I got this error :
Sep 13 01:18:01 ip-172-**-**-** systemd[1]: Starting A high performance web ser>
Sep 13 01:18:02 ip-172-**-**-** nginx[290356]: nginx: [emerg] invalid number of>
Sep 13 01:18:02 ip-172-**-**-** nginx[290356]: nginx: configuration file /etc/n>
Sep 13 01:18:02 ip-172-**-**-** systemd[1]: nginx.service: Control process exit>
Sep 13 01:18:02 ip-172-**-**-** systemd[1]: nginx.service: Failed with result '>
Sep 13 01:18:02 ip-172-**-**-** systemd[1]: Failed to start A high performance >
I have installed redis in my AWS server. I have followed this: https://www.digitalocean.com/community/tutorials/how-to-install-secure-redis-centos-7
$ systemctl start redis.service
$ systemctl enable redis
-> Created symlink /etc/systemd/system/multi-user.target.wants/redis.service → /usr/lib/systemd/system/redis.service.
$ systemctl status redis.service
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: failed (Result: exit-code) since Wed 2020-08-26 02:28:25 UTC; 10s ago
Main PID: 5012 (code=exited, status=1/FAILURE)
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: Starting Redis persistent key-value database...
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: Started Redis persistent key-value database.
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: redis.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 02:28:25 ip-xxx-xx-xx-xx.ap-southeast-2.compute.internal systemd[1]: redis.service: Failed with result 'exit-code'.
And when I check the /var/log/redis/redis.log this is what I see:
5012:C 26 Aug 2020 02:28:25.574 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5012:C 26 Aug 2020 02:28:25.574 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=5012, just started
5012:C 26 Aug 2020 02:28:25.574 # Configuration loaded
5012:C 26 Aug 2020 02:28:25.574 * supervised by systemd, will signal readiness
5012:M 26 Aug 2020 02:28:25.575 # Could not create server TCP listening socket 127.0.0.1:6379: bind: Address already in use
And upon checking the ports:
$ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 2812/redis-server *
tcp6 0 0 :::6379 :::* LISTEN 2812/redis-server *
This is showing the port 6379 is actually being used by redis-server.
So why cannot it start then?
Do I need to add any inbound/outbound rules in AWS? Please help.
UPDATE
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd command on terminal returns bash: /etc/redis.conf: Permission denied. Looks like need to give right permission to /etc/redis.conf file.
$ ls -l /etc/redis.conf
-rw-r-----. 1 redis redis 62189 Aug 26 03:04 /etc/redis.conf
So what permission do I need to give here? Who should own this file?
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
Prior to this prompt, the server was working fine, but when I tried to config the server for subdomain it failed to work with this error.
Also for detailed error ...
[ec2-user#ip--------- conf.d]$ systemctl status nginx.service
? nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2020-07-07 06:03:04 UTC; 4min 17s ago
Process: 71445 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 71444 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 70298 (code=exited, status=0/SUCCESS)
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy serv>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal nginx[71445]: nginx: [emerg] unexpected end of file, expec>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal nginx[71445]: nginx: configuration file /etc/nginx/nginx.c>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: nginx.service: Control process exited, code=ex>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: Failed to start The nginx HTTP and reverse pro>
lines 1-13/13 (END)
You can always check configuration errors by using this command :
nginx -T
before launch a catastrophic restart :)
You have an error unexpected end of file, check the syntax of your NGINX configuration as it is likely that you have a broken file.
The likely candidate is forgetting to close a } character.
I've been working on systemctl for a while and it's just not working.
I have tested with gunicorn and it works perfectly, but when I'm doing this
systemctl daemon-reload
systemctl enable flaskapp
systemctl start flaskapp
However, I've been getting issues like this
Dec 2 16:17:15 localhost systemd[1]: Started flaskapp.
Dec 2 16:17:15 localhost systemd[2130]: flaskapp.service: Failed at step EXEC spawning /home/flaskappuser/flaskapp/flaskvenv/bin/gunicorn: Permission denied
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Main process exited, code=exited, status=203/EXEC
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Unit entered failed state.
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Failed with result 'exit-code'.
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Service hold-off time over, scheduling restart.
Dec 2 16:17:15 localhost systemd[1]: Stopped flaskapp.
Dec 2 16:17:15 localhost systemd[1]: flaskapp.service: Start request repeated too quickly.
Dec 2 16:17:15 localhost systemd[1]: Failed to start flaskapp.
Dec 2 16:17:21 localhost systemd[1]: supervisor.service: Service hold-off time over, scheduling restart.
Dec 2 16:17:21 localhost systemd[1]: Stopped Supervisor process control system for UNIX.
Dec 2 16:17:21 localhost systemd[1]: Started Supervisor process control system for UNIX.
I tried with sudo and it doesn't work either. I have searched everything online but no result. Can anyone help me with this?
uwsgi.service - uWSGI Emperor service
Loaded: loaded (/etc/systemd/system/uwsgi.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sun 2016-05-22 05:46:09 EDT; 5min ago
Process: 6371 ExecStartPre=/usr/bin/bash -c mkdir -p /run/uwsgi; chown user:nginx /run/uwsgi (code=exited, status=1/FAILURE)
May 22 05:46:09 apxyws systemd[1]: Failed to start uWSGI Emperor service.
May 22 05:46:09 apxyws systemd[1]: Unit uwsgi.service entered failed state.
May 22 05:46:09 apxyws systemd[1]: uwsgi.service failed.
May 22 05:46:09 apxyws systemd[1]: uwsgi.service holdoff time over, scheduling restart.
May 22 05:46:09 apxyws systemd[1]: start request repeated too quickly for uwsgi.service
May 22 05:46:09 apxyws systemd[1]: Failed to start uWSGI Emperor service.
May 22 05:46:09 apxyws systemd[1]: Unit uwsgi.service entered failed state.
May 22 05:46:09 apxyws systemd[1]: uwsgi.service failed.
Does anybody know how to fix something like this, i am still newbie for setup things like this, been searching the answer but nothing similiar to me.
i just started using django and it worked using:
uwsgi --http :8080 --home /root/Env/apxweb --chdir /root/apxweb -w apxweb.wsgi
but when i started using it with nginx,
uwsgi service failure to start.
notes: nginx service worked.
Thanks Luke Dixon,
Yes the problem is within user,
I update the file like this:
/usr/bin/bash -c mkdir -p /run/uwsgi; chown root:nginx /run/uwsgi
uwsgi worked again,
i dont know if this is the correct way to fix uwsgi,
but anyway thank you very much.