Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: setting up LAMP
PostPosted: Wed Jun 06, 2012 6:22 am 
Offline
Senior Newbie

Joined: Wed Jun 06, 2012 6:14 am
Posts: 6
I am quite newbi to server configurations, so have been following the instructions on http://library.linode.com/lamp-guides/u ... 0.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!


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 7:40 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
What's the IP?

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

Code:
netstat -tulpen | grep :80


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 7:44 am 
Offline
Senior Newbie

Joined: Wed Jun 06, 2012 6:14 am
Posts: 6
Nuvini wrote:
What's the IP?

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

Code:
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 :)


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 7:48 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
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.


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 7:54 am 
Offline
Senior Newbie

Joined: Wed Jun 06, 2012 6:14 am
Posts: 6
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!


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 8:00 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
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:

Code:
update-rc.d -f nginx disable


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 8:05 am 
Offline
Senior Newbie

Joined: Wed Jun 06, 2012 6:14 am
Posts: 6
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?


Top
   
 Post subject:
PostPosted: Wed Jun 06, 2012 9:09 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
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!


Top
   
 Post subject:
PostPosted: Thu Jun 07, 2012 11:24 am 
Offline
Senior Newbie

Joined: Wed Jun 06, 2012 6:14 am
Posts: 6
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


Top
   
 Post subject:
PostPosted: Thu Jun 07, 2012 5:44 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
If you use Dynadot DNS (stolen from their website)
Quote:
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).


Top
   
 Post subject:
PostPosted: Thu Jun 07, 2012 6:55 pm 
Offline
Senior Newbie

Joined: Wed Jun 06, 2012 6:14 am
Posts: 6
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 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:

<VirtualHost *:80>
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
</VirtualHost>


Top
   
 Post subject:
PostPosted: Fri Jun 08, 2012 4:48 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
What's the output of the following?
Code:
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:
Code:
# 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)
Code:
# 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
</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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group