setting up LAMP

I am quite newbi to server configurations, so have been following the instructions on http://library.linode.com/lamp-guides/u … 0.04-lucid">http://library.linode.com/lamp-guides/ubuntu-10.04-lucid to set it up, the problem is after I execute apache to restart I get this error;

root@li245-126:~# /etc/init.d/apache2 restart

Restarting web server: apache2(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

Action 'start' failed.

The Apache error log may have more information.

failed!

I have contacted the support and they told me

"Apache is unable to listen for network connections on port 80 as nginx is already doing so."

so now I'm not even sure if apache got installed or not…

please any help is appreciated!

11 Replies

What's the IP?

Run the following command as root, what's the output?

netstat -tulpen | grep :80

@Nuvini:

What's the IP?

Run the following command as root, what's the output?

netstat -tulpen | grep :80

the server ip is 173.255.235.126

and the output is;

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 2927 1723/nginx

tcp6 0 0 :::80 :::* LISTEN 0 2928 1723/nginx

thanks for the help :)

Well, the guide you followed is for Apache, so I find it weird you now have nginx as well, why is that?

If you just want Apache you can remove nginx with apt-get remove nginx

or just do /etc/init.d/nginx stop

After that /etc/init.d/apache2 start should work.

ok now it makes sense what happened is a friend of mine had set up the sever initialy for a site that didnt require php or mysql, but now I needed to add more sites that did require php and mysql thats why I was going through the procedures to instal LAMP to support name-based virtual hosting as well as php and mysql ..

so what I got to do is then stop nginx and start apache with those comands….

thank you very much for the help!

PHP is possible with nginx, though personally I find it a lot simpler to do this with Apache. If you want to replace nginx with apache, (like youŕe doing with the LAMP procedure) make sure you disable the old one first: nginx.

You can't have 2 services listening on the same port ;)

So yep indeed, with /etc/init.d/nginx stop apache will be able to start.

Make sure you disable nginx to run at boot though, otherwise these 2 will conflict when you reboot the system.

To disable nginx at boot run:

update-rc.d -f nginx disable

thanks again for the help!

Do you work with servers? I might need some more help to get everything set up, I would like to learn the procedures so going to give it a try on my own, but just in case how much would you charge me to set it up?

I just do it as a hobby myself, so I can't guarantee I do everything correct myself. I believe most people here are wiling to help if you have further issues. If you're looking for a managed solution I've heard good things about VPSBuddy (http://vpsbuddy.com/) - but I don't have any personal experience with them.

Good luck!

thanks for the help.. another probably stupid question, I have a domain at www.dynadot.com but I can't find where to put the IP address for the domain to point to the server, only fields for name servers where can I see the info to put there?

thanks

If you use Dynadot DNS (stolen from their website)
> Log into your Dynadot account.

Click on the "Domains" tab in the main menu.

Click on the link listed in the "Name Server" column. After the page loads, you should see your current name server choice close to the top of the page.

Click on the "DNS" tab.

Select the Record Type, then enter in the IP Address or Target Host of your web server in the first text box.

If you have an Email Server or MX Record available for your domain email, enter in the hostname and the distance (otherwise known as priority) in the subsequent text boxes. You can also specify subdomain A records, CNAME records, email aliases (in the "Email Forwarding Settings" box), and a TXT record.

Click the "Use Dynadot DNS" button to save your changes.

Or if you want to use Linode log in to your control panel –> DNS Manager --> Add a zone and config it from there. Then at Dynazone change the nameservers to the following:

http://www.linode.com/wiki/index.php/Linode_DNS

Make sure you pick one of the two options, not both. Only one is needed (and can be used).

ok that worked, but now I have another error after configuring the virtual host as in http://library.linode.com/lamp-guides/u … tual-hosts">http://library.linode.com/lamp-guides/ubuntu-10.04-lucid#sph_configure-name-based-virtual-hosts when I restart apache I get:

Reloading web server config: apache2[Thu Jun 07 18:39:43 2012] [warn] default VirtualHost overlap on port 80, the first has precedence

[Thu Jun 07 18:39:43 2012] [warn] NameVirtualHost 173.255.235.126:443 has no VirtualHosts

and when I go to the domain I created the virtual host for hotmusicvideos.tv it conected to a diferent site 4yahoo.com I can see it by the email webmaster@4yahoo.com… the virtual host is as:

ServerAdmin webmaster@hotmusicvideos.tv

ServerName hotmusicvideos.tv

ServerAlias www.hotmusicvideos.tv

DocumentRoot /var/www/hotmusicvideos/

ErrorLog /var/www/hotmusicvideos/logs/error.log

CustomLog /var/www/hotmusicvideos/logs/access.log combined

What's the output of the following?

ls /etc/apache2/sites-enabled/

AFAIK Apache sorts out the priority of vhosts by the alphabet/numeric. So normally you would need 2+ vhosts with multiple domains:

a 0-default (or something with a 0 to make sure it comes first). Now when someone visits your site by IP and there's no corresponding domain the person will get that page (so it's like a fallback/default page if nothing else matches)

I use this for mine:

# vHost configuration
 <virtualhost *:80="">ServerAdmin admin@nuvini.com
     ServerName nuvini.com
     ServerAlias www.nuvini.com

# Logs
     DocumentRoot /srv/www/nuvini.com/public_html/
     ErrorLog /srv/www/nuvini.com/logs/error.log
     CustomLog /srv/www/nuvini.com/logs/access.log combined</virtualhost> 

# Enable Rewrite
RewriteEngine On

I believe you can make a subdomain like "placeholder.hotmusicvideos.tv "and give people that page when something is invalid

(Though actually, purely for a fallback rewrite should not be needed)

After that your actual vhosts for normal content: (Editing out the domains since it's a private domain I use)

# vHost configuration
 <virtualhost *:80="">ServerAdmin admin@nuvini.com
     ServerName <snip>ServerAlias www. <snip># Logs
     DocumentRoot /srv/www/<snip>/public_html/
     ErrorLog /srv/www/<snip>/logs/error.log
     CustomLog /srv/www/<snip>/logs/access.log combined</snip></snip></snip></snip></snip></virtualhost> 

# Enable Rewrite
RewriteEngine On

Regarding your errors:

The first one: I guess it is something wrong with the default vhost that is enabled (the one where I used 0-default. Try the thing I posted above?

Second one: I think it means you're also listening on HTTPS (443) but there's no vhost configured for that port. If you're just using HTTP, so no HTTPS, disable listening on port 443 in the apache configuration. (Otherwise, adjust the virtualhost to also listen on port 443, and not just 80)

Also I'm not sure where you got the 4yahoo from, is it a site you own/host? Or did you insert this anywhere in your configuration?

Lastly, the edits you make with the vhosts: use /etc/apache2/sites-available to make the edits. The ones in sites-enabled are links to the sites-available files. Use a2ensite and a2dissite to disable/enable the virtual hosts. (e.g. a2dismod default if you have a filed called default in /etc/apache2/sites-available/)

Good luck, hope it's a bit clear :p

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct