reinstall nginx if i delete /etc/nginx in centos server how to reinstall it again i am new in centos and nginx - linux

i install nginx in my remote server but i done some error in my nginx.conf file and could not able to revert back
so it tried to remove my nginx and reconfigure it
so i used these step which is given in the link to delete my nginx
http://www.ehowstuff.com/how-to-remove-uninstall-nginx-on-centos-7-rhel-7-oracle-linux-7/
then i use yum remove nginx and again reinstall it
but when i try sudo systemctl start nginx or [root#lotto nginx]# service nginx start
its showing
Job for nginx.service failed because the control process exitenter code hereed with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
when i am using
[root#lotto nginx]# systemctl status nginx.service
showing
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-07-01 07:48:44 EDT; 18s ago
Process: 30832 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 30830 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 14307 (code=exited, status=0/SUCCESS)
Jul 01 07:48:44 lotto systemd[1]: Starting The nginx HTTP and reverse proxy server...
Jul 01 07:48:44 lotto nginx[30832]: nginx: [emerg] getpwnam("nginx") failed in /etc/nginx/nginx.conf:5
Jul 01 07:48:44 lotto nginx[30832]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jul 01 07:48:44 lotto systemd[1]: nginx.service: control process exited, code=exited status=1
Jul 01 07:48:44 lotto systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jul 01 07:48:44 lotto systemd[1]: Unit nginx.service entered failed state.
Jul 01 07:48:44 lotto systemd[1]: nginx.service failed.
and [root#lotto nginx]# journalctl -xe
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-07-01 07:48:44 EDT; 18s ago
Process: 30832 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
Process: 30830 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 14307 (code=exited, status=0/SUCCESS)

uninstall
yum remove nginx
install
In CentOS , you should using yum install ; instead of apt-get install in Ubuntu.

at last I found out the solutions by my self
I used nginx -t which shows that I don't have any syntax error in my code
Then I use
user nobody; // in my nginx.conf
This solved my problem
Thanks everyone for your help!

Related

Im trying to restart httpd.service but i get an error

on doing sudo systemctl restart httpd.service i get this error
[opc#xxxx ~]$ sudo systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xeu httpd.service" for det ails.
systemctl status httpd.service shows me this
× httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2022-11-05 05:48:10 GMT; 2min 54s ago
Docs: man:httpd.service(8)
Process: 48848 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 48848 (code=exited, status=1/FAILURE)
Status: "Reading configuration..."
CPU: 46ms
Nov 05 05:48:09 xxxxx systemd[1]: Starting The Apache HTTP Server...
Nov 05 05:48:10 xxxxx systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Nov 05 05:48:10 xxxxx systemd[1]: httpd.service: Failed with result 'exit-code'.
Nov 05 05:48:10 xxxxx systemd[1]: Failed to start The Apache HTTP Server.
and journalctl -xeu httpd.service shows this message
i changed the port to 80 from 443 and nothing happened

RabbitMQ server won't start anymore after assigning username/password

I installed a rabbitmq server and it was active and running fine until I entered:
echo "[{loopback_users, []}]}]." > /etc/rabbitmq/rabbitmq.config
I also assigned a username and password and also assigned the user as administrator. I tried to restart the server after that and it wouldn't restart. Checked the status and it was no longer running. Any idea what I did wrong? Still a rookie, any tips would be great.
[root#rmq01 ~]# systemctl status rabbitmq-server.service -l
● rabbitmq-server.service - RabbitMQ broker
Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2022-08-12 05:47:22 UTC; 1s ago
Process: 1807 ExecStop=/usr/sbin/rabbitmqctl shutdown (code=exited, status=0/SUCCESS)
Process: 7026 ExecStart=/usr/sbin/rabbitmq-server (code=exited, status=1/FAILURE)
Main PID: 7026 (code=exited, status=1/FAILURE)
Status: "Standing by"
Aug 12 05:47:22 rmq01 systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=1/FAILURE
Aug 12 05:47:22 rmq01 systemd[1]: Failed to start RabbitMQ broker.
Aug 12 05:47:22 rmq01 systemd[1]: Unit rabbitmq-server.service entered failed state.
Aug 12 05:47:22 rmq01 systemd[1]: rabbitmq-server.service failed.
I'm sure the answer is right in front of me but I can't seem to pin point it.
please use the new format file config:
https://github.com/rabbitmq/rabbitmq-server/blob/v3.8.x/deps/rabbit/docs/rabbitmq.conf.example
## Related doc guide: https://rabbitmq.com/access-control.html.
## The default "guest" user is only permitted to access the server
## via a loopback interface (e.g. localhost).
## {loopback_users, [<<"guest">>]},
##
# loopback_users.guest = true

NGINX error after 'sudo systemctl status nginx' - Failed with result 'exit-code'

After trying to add new domains do my ubuntu 20.04 cloud server with nginx and pm2,I created a server block in
'/etc/nginx/sites-available/mydomain.ar'
and did the same thing into
'/etc/nginx/sites-enabled/mydomain.ar'
The next step was to do a link to both files with
ln -s /etc/nginx/sites-available/cloud.ktsoftware.ar /etc/nginx/sites-enabled/cloud.ktsoftware.ar
got a error that files already existed
ln: failed to create symbolic link '/etc/nginx/sites-enabled/mydomain.ar': File exists
in consequence i run to forced the link
sudo ln -sf /etc/nginx/sites-available/cloud.ktsoftware.ar /etc/nginx/sites-enabled/cloud.ktsoftware.ar
everything appears ok, no error response after that. Then i do
sudo systemctl status nginx
and got this error:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-07-10 13:47:17 -03; 17min ago
Docs: man:nginx(8)
Process: 1287489 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
below first error paragraph
Jul 10 13:47:17 vps-2421400-x systemd[1]: nginx.service: Succeeded.
Jul 10 13:47:17 vps-2421400-x systemd[1]: Stopped A high performance web server and a reverse proxy server.
Jul 10 13:47:17 vps-2421400-x systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 10 13:47:17 vps-2421400-x nginx[1287489]: nginx: [emerg] open() "/etc/nginx/sites-enabled/mydomain.conf" failed (2: No such file or directory) in /etc/n>
Jul 10 13:47:17 vps-2421400-x nginx[1287489]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jul 10 13:47:17 vps-2421400-x systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jul 10 13:47:17 vps-2421400-x systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 10 13:47:17 vps-2421400-x systemd[1]: Failed to start A high performance web server and a reverse proxy server.
lines 1-14/14 (END)
"lines 1-14/14 (END)" *
and crashed everything i think.
What is the best way to link the domains server blocks?

Unable to run mongoDB after installation

I'm On fedora 34 and trying to install mongoDB on this machine.
I followed installation instruction from official Docs from here. Everything installed correctly, but now i'm unable to start the service.
I executed sudo systemctl start mongod and it showed
root#fedora /v/l/mongodb [100]# systemctl start mongod
Job for mongod.service failed because the control process exited with error code.
See "systemctl status mongod.service" and "journalctl -xeu mongod.service" for details.
This is the source for mongod.service in /usr/lib/systemd/system/mongod.service
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network-online.target
Wants=network-online.target
[Service]
User=mongod
Group=mongod
Environment="OPTIONS=-f /etc/mongod.conf"
EnvironmentFile=-/etc/sysconfig/mongod
ExecStart=/usr/bin/mongod $OPTIONS
ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb
ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb
ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb
PermissionsStartOnly=true
PIDFile=/var/run/mongodb/mongod.pid
Type=forking
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# locked memory
LimitMEMLOCK=infinity
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for mongod as specified in
# https://docs.mongodb.com/manual/reference/ulimit/#recommended-ulimit-settings
[Install]
WantedBy=multi-user.target
I think problem begins here
12 ExecStart=/usr/bin/mongod $OPTIONS
I'm a noob in systemd and daemons and services
This is the log from systemctl status mongod.service
root#fedora /v/l/mongodb [1]# systemctl status mongod.service
× mongod.service - MongoDB Database Server
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2021-08-01 11:18:36 IST; 16min ago
Docs: https://docs.mongodb.org/manual
Process: 8116 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 8117 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 8118 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 8119 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
CPU: 149ms
Aug 01 11:18:36 fedora systemd[1]: Starting MongoDB Database Server...
Aug 01 11:18:36 fedora mongod[8119]: about to fork child process, waiting until server is ready for connections.
Aug 01 11:18:36 fedora mongod[8122]: forked process: 8122
Aug 01 11:18:36 fedora mongod[8119]: ERROR: child process failed, exited with 14
Aug 01 11:18:36 fedora mongod[8119]: To see additional information in this output, start without the "--fork" option.
Aug 01 11:18:36 fedora systemd[1]: mongod.service: Control process exited, code=exited, status=14/n/a
Aug 01 11:18:36 fedora systemd[1]: mongod.service: Failed with result 'exit-code'.
Aug 01 11:18:36 fedora systemd[1]: Failed to start MongoDB Database Server.
Your mongodb exited with status code 14 as systemctl status says.
Here you can find the answer

Not able to reload Nginx

$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nginx.service.d
└─override.conf
Active: active (running) since Wed 2020-01-22 15:34:55 IST; 18min ago
Process: 51312 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 51324 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Jan 22 15:34:55 beta-app2 systemd[1]: Starting A high performance web server and a reverse proxy server...
Jan 22 15:34:55 beta-app2 systemd[1]: Started A high performance web server and a reverse proxy server.
Jan 22 15:48:48 beta-app2 systemd[1]: Reloading A high performance web server and a reverse proxy server.
Jan 22 15:50:18 beta-app2 systemd[1]: nginx.service: Reload operation timed out. Killing reload process.
Jan 22 15:50:18 beta-app2 systemd[1]: Reload failed for A high performance web server and a reverse proxy server.
Please find the logs we are not able to reload Nginx. As we checked the file with the command "sudo nginx -t" and getting successful logs.But still we are getting this error. Please assist me to fix this.

Resources