I built an environment from centos installation to php source expansion on linux, but what to do when a browser error occurs

When the error page of CASE1.nginx appears

e1.JPG

I can't even start nginx with the following error.

#restart nginx
sudo systemctl restart nginx
#When I use this command, I get the following error.

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

As for the error content, nginx could not be executed. "systemctl status nginx.service" and "journalctl -xe" Please write down the details.

[root@localhost www]# sudo systemctl -l status nginx.service
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code)since tree 2020-08-13 15:42:14 JST; 5s ago
     Docs: http://nginx.org/en/docs/
  Process: 2591 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

August 13 15:42:11 localhost nginx[2591]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
August 13 15:42:12 localhost nginx[2591]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
August 13 15:42:12 localhost nginx[2591]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
August 13 15:42:13 localhost nginx[2591]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
August 13 15:42:13 localhost nginx[2591]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
August 13 15:42:14 localhost nginx[2591]: nginx: [emerg] still could not bind()
August 13 15:42:14 localhost systemd[1]: nginx.service: control process exited, code=exited status=1
August 13 15:42:14 localhost systemd[1]: Failed to start nginx - high performance web server.
August 13 15:42:14 localhost systemd[1]: Unit nginx.service entered failed state.
August 13 15:42:14 localhost systemd[1]: nginx.service failed.

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) The error says that port 80 is already in use and cannot be executed. So check what is being used on port 80.

sudo lsof -i :80

COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   2776 apache    4u  IPv6  25135      0t0  TCP *:http (LISTEN)
httpd   2777 apache    4u  IPv6  25135      0t0  TCP *:http (LISTEN)
httpd   2778 apache    4u  IPv6  25135      0t0  TCP *:http (LISTEN)
httpd   2779 apache    4u  IPv6  25135      0t0  TCP *:http (LISTEN)
httpd   2780 apache    4u  IPv6  25135      0t0  TCP *:http (LISTEN)
httpd   2781 apache    4u  IPv6  25135      0t0  TCP *:http (LISTEN)

I wanted to open it with nginx, but apache was occupying number 80. So uninstall apache.

sudo yum remove -y httpd apr apr-util httpd-tools

#Restart nginx
sudo systemctl restart nginx

#Automatic start registration of nginx
systemctl enable nginx

Now you should be able to start nginx.

Finally, you can use the nginx -t command to check if the syntax of the nginx configuration file is correct.

nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If CASE2.nginx is running but php-fpm is not working properly

e2.JPG
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

First, look at the error log to confirm and clarify the cause.

The error log is /var/log/nginx/error.log or /var/log/php-fpm/error.log, so

cat /var/log/nginx/error.log

2020/08/13 16:26:10 [crit] 2867#2867: *2 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.97, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "192.168.168.90"
2020/08/13 16:26:10 [error] 2867#2867: *2 open() "/var/www/html/favicon.ico" failed (2: No such file or directory), client: 192.168.0.97, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "192.168.168.90", referrer: "http://~~/"

Explanation of error statement

/var/www/html/favicon.ico" failed The error that there is no icon is through because it has nothing to do with opening the browser

connect() to unix:/var/run/php-fpm/php-fpm.sock failed An error is occurring because the unix socket file cannot be received. This can be solved by rewriting the php-fpm configuration file.

The config file is usually located below, so let's open it.

vi /etc/php-fpm.d/www.conf

If the following line is commented out with;, delete it.

This usually opens.

Recommended Posts

I built an environment from centos installation to php source expansion on linux, but what to do when a browser error occurs
What to do when an error occurs with import _ssl
What to do when you get an error saying "Name resolution temporarily failed" on linux
What to do if an error occurs when importing numpy with VScode
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do when psycopg2 throws an error when pipenv lock under Pipenv environment
[Django] What to do if an Integrity Error occurs when registering data from the management site to the database
[python] What to do when an error occurs in send_keys of headless chrome
What to do when SSL error occurs in pip in Windows10, miniconda, VScode environment
What to do if an SSL connection error (ssl.SSLError: [SSL: DH_KEY_TOO_SMALL]) occurs on Ubuntu 20.04
What to do if an error occurs when loading a python project created with poetry into VS Code
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if SciPy installation fails on CentOS
What to do when matplotlib gets angry on CentOS saying "I'm using Agg so I can't issue a figure"
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you get an error when vagrant up when you enable public_network or private_network on Vagrant + Arch Linux → Install netctl
What I was addicted to when dealing with huge files in a Linux 32bit environment
What to do if you get an error when running "certbot renew" in CakePHP environment
I got an error when I tried to process luigi in parallel on windows, but the solution
What to do if pip --user returns an error in a virtual environment created with pyenv
About the error I encountered when trying to use Adafruit_DHT from Python on a Raspberry Pi
I tried to create an environment of MkDocs on Amazon Linux
A note I was addicted to when making a beep on Linux
What I stumbled upon when using CodeIgniter on a Linux server
What to do if you get a Permission denied (public key) error when trying to pull on Github
I want to pass an argument to a python function and execute it from PHP on a web server
What to do if you get stuck during Anaconda installation on Linux
What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do if you are told "Import Error: cannot import name'HTTPSHandler'" when building a virtual environment using virtualenv
I built a TensorFlow environment on windows10
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
What I was addicted to when creating a web application in a windows environment
[Python] I want to know the variables in the function when an error occurs!
What to do if CERTIFICATE_VERIFY_FAILED occurs when nltk.download () is done on macOS pyhon
What to do if Django can't load an image from a static folder
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do if you get an error when installing python with pyenv
What to do if a version error occurs in the selenium Chrome driver
What to do when you want to receive files from a Windows client remotely
I made a package to create an executable file from Hy source code
What to do if a communication error occurs due to proxy when installing with package management of pip, npm, gem
What to do when PermissionError of tempfile.mkstemp occurs
What I did when updating from Python 2.6 to 2.7
What to do if you get an "unknown service" error from your gRPC server
I had a hard time trying to access Hadoop3.0.0 from a browser (and Arch Linux)
I get a "bash: sudo: command not found" error on LINUX (Debian) built on Docker
Source compile Apache2.4 (httpd 2.4.43) + PHP7.4 on Linux to build a Web server --3 MySQL 8.0 introduction
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do when "Type Error: must be _socket.socket, not socket" appears on GAE
I get an error when I try to raise Python to 3 series using pyenv on Catalina