New Server Config With Nginx - Httpd Will Not Start

Hi perhaps I might find the solution on this forum as it relates to configuring a vps to unleash the power of a CS Cart.

I made an attempt to instal a LEMP stack on my CentOS 6.8 VPS following the instructions here:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-6

With a small caveat that I instead of PHP 5.3 opted for PHP 7.

All seemed to be okay exempt for the httpd that will not start properly

[root@amjordan ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

What could i have been missing here ?

Another daemon is listening on port 80.
Run this command:

netstat -anp | grep :80 | grep LISTEN

Above command lists out all processes running and listening on port 80

Furthermore make sure you are not declaring Listen 80 twice in .conf files. For example, you might have it both in ports.conf and inn sites-enabled/www.conf.To find out, use:

grep -ri listen /etc/apache2

Keep Listen 80 in just a single place.

Next scenario may be that nginx is using the port 80.

Try shutting it down with:

service nginx stop


or

killall -9 nginx


and then start httpd

Another daemon is listening on port 80.
Run this command:

netstat -anp | grep :80 | grep LISTEN

Above command lists out all processes running and listening on port 80

Furthermore make sure you are not declaring Listen 80 twice in .conf files. For example, you might have it both in ports.conf and inn sites-enabled/www.conf.To find out, use:

grep -ri listen /etc/apache2

Keep Listen 80 in just a single place.

Next scenario may be that nginx is using the port 80.

Try shutting it down with:

service nginx stop

or

killall -9 nginx

and then start httpd

Dear martfox

I tried the first

Another daemon is listening on port 80.
Run this command:

netstat -anp | grep :80 | grep LISTENAbove command lists out all processes running and listening on port 80

and results where

[root@amjordan ~]# netstat -anp | grep :80 | grep LISTEN
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      31642/nginx         
tcp        0      0 :::80                       :::*                        LISTEN      31642/nginx         
[root@amjordan ~]# 

then you suggested

Furthermore make sure you are not declaring Listen 80 twice in .conf files. For example, you might have it both in ports.conf and inn sites-enabled/www.conf.To find out, use:

grep -ri listen /etc/apache2Keep Listen 80 in just a single place.

The results were

[root@amjordan ~]# grep -ri listen /etc/apache2
grep: /etc/apache2: No such file or directory
[root@amjordan ~]# 

By know Nginx seems to be culprit

Next scenario may be that nginx is using the port 80.

Try shutting it down with:

service nginx stop

as after stopping nginx and restart httpd

we get the following by restarting nginx

[root@amjordan ~]# sudo service nginx restart
Stopping nginx:                                            [FAILED]
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
                                                           [FAILED]
[root@amjordan ~]# 

What next ?

EDITED:

So now, it's the same scenario but with nginx. You will have to edit some server files. Are you familiar with nano editor?

Also it seems, the NGINX configuration is wrong...

you cannot have nginx and httpd on the same port

Check this https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache

EDITED:

So now, it's the same scenario but with nginx. You will have to edit some server files. Are you familiar with nano editor?

Yes I am, find it much friendlier than vi

Any success with the configuration from https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache ?

Have you guys checked serverpilot.io ? I found it much more simplistic and gets the job done.

Have you guys checked serverpilot.io ?

It's very limited. All it does is allows you to set up a directory, database, and domain for a app.

Not yet

I am looking at the instructions martfox.

I am a bit confused, I cannot remember installing Apache actually on this VPS. The instructions I followed did not speak of Apache but of Nginx.

I only deviated from the original instructions given here

https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-6

as where I replaced the instruction for php 5.3 for these http://tecadmin.net/install-php-7-on-centos/

I guess I mixed things up a bit.

Now I have to start to undo what I did wrong

Have you guys checked serverpilot.io ? I found it much more simplistic and gets the job done.

No I have not and I am not looking for a cpanel replacement

[attachment=12072:configure-nginx.jpg]

@martfox

I presume that this suggests that I have already setup virtual hosts but I have not.

sudo nano /etc/nginx/ .... is empty 

Step 3 was about installing nginx and in step 4 in this digitalocean.com tutorial they talked about installing PHP. As it turned out it was PHP 5.3 and not PHP 7 as I intended. I unstalled PHP 5.3 and use the tutorial of techadmin.com

http://tecadmin.net/install-php-7-on-centos/

To install PHP 7.0 and from there on I returned to Step 5 of the digitalocean tutorial i was following where it says that step 5 is all about configuring php.

I presume there is where it went wrong for me.

configure-nginx.jpg

No I have not and I am not looking for a cpanel replacement

I understand. It is not just cpanel replacement but it sets up:

nginx as proxy with SSL support => apache => php fpm with opcache => mysql

It is very difficult to get this setup up and running individually.

Good luck with your setup.

I understand. It is not just cpanel replacement but it sets up:

nginx as proxy with SSL support => apache => php fpm with opcache => mysql

It is very difficult to get this setup up and running individually.

Good luck with your setup.

Thanks mazter. I will surely keep your suggestion as a backup plan should this truly fail.

Hi. Consider looking at our official documentation, which tells how to configure a VPS for the maximum CS-Cart performance following three simple steps: http://docs.cs-cart.com/4.4.x/developer_guide/getting_started/server_ansible_playbooks.html

@Mongoose

Ok, but are apache and nginx now running?

@Mongoose

Ok, but are apache and nginx now running?

I had a friend walk me through the steps I followed before but as it turned out my firewall blocked port 80 that is one thing and the other is that I am still in the process of making nginx work for me.

Hi. Consider looking at our official documentation, which tells how to configure a VPS for the maximum CS-Cart performance following three simple steps: http://docs.cs-cart.com/4.4.x/developer_guide/getting_started/server_ansible_playbooks.html

@abolshakov

What is this Playbook actually ? Is it a script that can be executed at this moment when I am still having to get Nginx to accept and execute php files ?

@abolshakov

What is this Playbook actually ? Is it a script that can be executed at this moment when I am still having to get Nginx to accept and execute php files ?

Playbook is an Ansible's configuration language. Ansible is a software configuration management tool. It describes a set of steps you want to execute. So, @cscart/server-ansible-playbooks helps to configure environment for CS-Cart and Multi-Vendor. You should use lemp7.yml to set up NGINX + PHP-FPM 7.0.x. (FastCGI). This is the easiest way to bootstrap your server from scratch without any knowledge of server configuration.