Apache won't start (Centos 7 server + Nginx)

2 posts / 0 new
Last post
#1 Thu, 08/03/2017 - 04:24
dswong

Apache won't start (Centos 7 server + Nginx)

Hi,

I'm having a problem with my configuration. I have Centos 7 install with Nginx, Apache and Virtualmin. I'm trying to configure Nginx as a reverse proxy for Apache. Nginx is configured to listen to port 80 and 443 for SSL.

I have added the following in the file : /etc/nginx/conf.d/default.conf

server {
        listen   80;

        root /usr/share/nginx/html/;
        index index.php index.html index.htm;

        server_name localhost;

        location / {
        try_files $uri $uri/ /index.php;
        }

        location ~ \.php$ {
       
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:8080;

         }

         location ~ /\.ht {
                deny all;
        }
}

and I have added the following in the file : /etc/httpd/conf/httpd.conf

Listen 127.0.0.1:8080

and

DocumentRoot "/usr/share/nginx/html/"

This is the output of "service httpd status" :

* httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2017-08-03 05:09:27 EDT; 9min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 5600 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 5598 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 5598 (code=exited, status=1/FAILURE)

Aug 03 05:09:26 server httpd[5598]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
Aug 03 05:09:26 server httpd[5598]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
Aug 03 05:09:26 server httpd[5598]: no listening sockets available, shutting down
Aug 03 05:09:26 server httpd[5598]: AH00015: Unable to open logs
Aug 03 05:09:27 server systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 03 05:09:27 server kill[5600]: kill: cannot find process ""
Aug 03 05:09:27 server systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 03 05:09:27 server systemd[1]: Failed to start The Apache HTTP Server.
Aug 03 05:09:27 server systemd[1]: Unit httpd.service entered failed state.
Aug 03 05:09:27 server systemd[1]: httpd.service failed.

and the output of "netstat -plutn | grep 443" is


tcp        0      myIP:443        0.0.0.0:*               LISTEN      5575/nginx: master

What did I did wrong? Please help.

Thu, 08/03/2017 - 09:34
dswong

Problem solved.

There is a default configuration in Virtualmin for Apache to listen to port 443 and 80. Removed 443 and changed 80 to 8080 solved it.

Topic locked