Professional Documents
Culture Documents
Tuxtweaks Com
Tuxtweaks Com
COMMENTS
Tux Tweaks
Linux Tweaks, HowTo's and Reviews
Home
About
Privacy Policy
SUBSCRIBE BY EMAIL
RECENT POSTS
We now have a directory called webdev under our home directory. Within the webdev directory are two
directories called site1 and site2.
cd /etc/apache2/sites-available
As root, copy the default file as site1.
command
line dell Distro Review
Chromium
cd
mkdir webdev
cd webdev
mkdir site1 site2
cd ~/webdev/site1
echo 'Site1 works!' > index.html
cd ../site2
echo 'Site2 works!' > index.html
gnome google
HowTo HP humor
Edit the file to look like this (the changes are in bold).
ImageMagick jaunty
karmic koala LAMP
<VirtualHost *:80>
GO
Subscribe
Delivered by
FeedBurner
TOP CONTENT
Select Category
ARCHIVES
2012 (10)
May (2)
Distro Review:
Linux Mint 13
"Maya" Cinnamon
Edition
Fixing Common
Problems with
LAMP on Ubuntu
Apr (4)
Mar (3)
Jan (1)
2011 (26)
2010 (60)
2009 (89)
converted by Web2PDFConvert.com
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName site1
2009 (89)
2008 (37)
FAVORITE SITES
DocumentRoot /home/yourID/webdev/site1/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/yourID/webdev/site1/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Ithaca Presbyterian
Church
Tux Machines
Ubuntu Forums
converted by Web2PDFConvert.com
Comments
149 Responses to How to Configure Apache Web Server on Linux
Older Comments
Nipun says:
November 26, 2011 at 9:16 AM
HI.Thanks for the great tutorial.
Whenever i reload apache2 i get the following:
* Reloading web server config apache2 [Sat Nov 26 19:42:10 2011] [warn] NameVirtualHost *:0 has no
VirtualHosts
[Sat Nov 26 19:42:10 2011] [warn] NameVirtualHost *:0 has no VirtualHosts
Also i am not able to send "PUT" requests via any REST client(for eg Google Chrome has an extension for the
same)
Reply
Linerd says:
November 26, 2011 at 11:21 AM
Your virtual host file should refer to *:80 for port 80, not *:0.
Reply
raj says:
April 5, 2012 at 4:56 AM
U have to /etc/apache2/httpd.conf ----------- servername localhost . U won't get the error
Reply
raj says:
April 5, 2012 at 5:00 AM
U need to do this in /etc/apache2/site-available/site1 -------- DocumentRoot which u have
create a directory site folder
Reply
raj says:
April 5, 2012 at 5:59 AM
Try it...........
/etc/apache2/site-available/site1.............
DocumentRoot
a2dissite default
a2ensite
service apache2 reload
service apache2 restart
u can see that error won't get u..............[warn] NameVirtualHost *:0 has no VirtualHosts
Paul says:
December 6, 2011 at 11:43 AM
Great tutorial. I'm new to this stuff. Did the same thing for site2 as suggested but it didn't work! It
generated the index.html output from /var/www/ instead. I think the tutorial needed to be a little more concise
with regards to site2. Checked my scripts to ensure that there were no typo's. Should the first line in /etc/hosts
read "127.0.0.1 localhost site1 site2" for instance?
converted by Web2PDFConvert.com
Reply
Matt says:
January 10, 2012 at 8:33 AM
"Should the first line in /etc/hosts read "127.0.0.1 localhost site1 site2" for instance?"
No, each site requires a new line so instead of "127.0.0.1 localhost site1 site2" it should be:
127.0.0.1 localhost site1
127.0.0.1 localhost site2
You just repeat the steps you did to create site1 in order to create site2, site3, etc. except you add a line in
/etc/hosts for each new site. Also, your site name can be pretty much any name you want (it doesn't have
to be "site1").
Reply
Linerd says:
May 15, 2012 at 7:57 AM
I use
Nipun says:
December 13, 2011 at 5:48 AM
Hi,Thanks for the wonderful tutorial.If i wish to view say index.html under site1 from another computer
connected over LAN,how can i do that.
So from my other computer if i fire http://site1/index.html it should render the contents
Reply
Rodrigo says:
December 20, 2011 at 2:26 PM
Hi there,
I did it exactly the way you explained, and everything has been set up right. The only problem happened in the
end ..
phpmyadmin could not be found ... i've got an 404 error, even with the "success" message at the end of
installation "ldconfig deferred processing now taking place"
what could be the error?
Thanks that much ..
hugs from Brazil
Reply
Linerd says:
December 20, 2011 at 2:31 PM
Look at this post: http://tuxtweaks.com/2011/10/install-lamp-and-phpmyadmin-on-ubuntu-11-10/
and find the section near the bottom that refers to Fixing phpMyAdmin.
Reply
Sugiono says:
January 12, 2012 at 10:06 PM
Hello again,
I checked each step , and everything looks good. testing.php and phpmyadmin run smoothly. the only thing
when I try to execute install.php, the browser stop and blank.
Can you please advise? I did change the /etc/apache2/sites-available/[sitename] ,
Options Indexes FollowSymLinks MultiViews
AllowOverride All ( and also to AuthConfig>
Order allow,deny
allow from all
restart the apache, and still not working. pls anyone can help?
Reply
Linerd says:
January 13, 2012 at 8:36 AM
What is install.php? What is is supposed to do?
Reply
converted by Web2PDFConvert.com
sugiono says:
February 11, 2012 at 6:59 AM
install.php is an executable file for my php package / module, but no worry about that first since
i am still figuring out how to enable site 1 and site 2 since everytime i reload apache,
result
error line 13
unable to resolve host 0.0.0.0:80
thus i can never access index.html i have stored in that directory, instead it shows the index.html from
/var/www
i do not know what happend, i edit /etc/hosts and erase the 127.0.1.1 ubuntu , since i thought that is
the confusing culprit everytime the apache2 want to restart,
can you please help me straight this out, thanks in advance
Reply
sugiono says:
February 11, 2012 at 7:01 AM
the exact message is
sugiono@ubuntu:~$ service apache2 reload
* Reloading web server config apache2 ulimit: 88: error setting limit (Operation not permitted)
apache2: apr_sockaddr_info_get() failed for ubuntu
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for
ServerName
httpd not running, trying to start
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'graceful' failed.
The Apache error log may have more information.
Reply
sugiono says:
February 11, 2012 at 7:22 AM
this problem arise since I install ubuntu server on my pc.
the creating a web development directory was fine, but then i was unable to execute
install.php ( see my top posting), so i clean install everything and start with ubuntu server,
ubuntu desktop and LAMP.
I forward my server ( port 80 ) so that I can have it alive. it went great for /var/www web,
but when i tried to have the second hosting, web development, fail with the above message (
see my 3rd posting) although the name site1 can be accessible ( direct to /var/www, where it
should be /home/webdev/site1 )
Linerd says:
February 11, 2012 at 1:06 PM
Do you get the same errors if you use sudo with the above command?
Linerd says:
February 11, 2012 at 1:12 PM
Don't remove that line from /etc/hosts. It should work with it in there and removing it may
mess up something else.
I think you need to find the file that is referencing IP address 0.0.0.0:80. Since you're working with
your local machine, it should probably reference 127.0.0.1:80
Reply
Stanislav says:
January 15, 2012 at 11:05 AM
MANY MANY THANKS. 5:00 was trying to make a virtual host on a pile of manuals, only your fully
working. Thank you!
Reply
Sachith says:
February 8, 2012 at 7:58 AM
converted by Web2PDFConvert.com
sugiono says:
February 11, 2012 at 7:39 AM
maybe below can give more information ( note that site1 name is mysite here )
sugiono@ubuntu:~$ apachectl -S
ulimit: 88: error setting limit (Operation not permitted)
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server localhost (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost mysite (/etc/apache2/sites-enabled/mysite:1)
Syntax OK
Reply
zaldy says:
March 11, 2012 at 6:51 AM
followed the instructions here and everything came out as expected. thanks!
Reply
Larsen says:
April 3, 2012 at 2:19 PM
I keep getting the same error
Forbidden
You don't have permission to access / on this server.
Apache/2.2.20 (Ubuntu) Server at site1 Port 80
I tried to rerun the tutorial, but still the same : / any idea what went wrong?
Reply
Lah says:
April 8, 2012 at 8:41 PM
Thank you for this tutorial. Could you give a bit more explanation on Apache directives in more simple as
this configuration. Also add some comments in the files. thank you
Reply
Linerd says:
April 8, 2012 at 10:14 PM
After reading this post, you pretty know everything I know about Apache
I know it's not the easiest reading, but I suggest you check out the official Apache documentation.
Reply
Pawan says:
April 15, 2012 at 1:37 PM
hey! thanks for this!
I was planning to have a local wordpress development environment setup. so i followed your tutorial and
everything worked.
except one. when i create a new post or page and publish it, and try to open its permalink, i get the 404 error. it
says that the link can not be found on Apache2(ubuntu) server at port 80.
moreover, it displays the url as "/permalink" rather than "site1/permalink".
what is going wrong?
Reply
Linerd says:
April 15, 2012 at 11:23 PM
It sounds like mod_rewrite isn't working. Did you change AllowOverride to All under the <directory
/home/yourID/webdev/site1/> section?
Reply
converted by Web2PDFConvert.com
bifs says:
April 17, 2012 at 12:50 PM
Excelent tutorial but I have a more especifc question regarding permissions:
Supposing I don't want do change from /var/www main directory, and that I am programming from an external
computer with Netbeans updating files directly on the server, what should be /var/www permissions? And owner
of the directory?
With only one site I managed it, but now I have other projects and I am trying to setup a SVN subvservion
repository and everything goes right until it's time to write inside /var/www/whatever...
Could you please, give me some tips?
Thanks in advance!
Reply
ans says:
May 14, 2012 at 8:36 PM
Hey there,
Thank you for the tutorial. I follow all the steps on ubuntu 12.04, but when I enter site1 or site2 on the address
bar it is always the content of the default.html which is displayed. I check that site1 and site2 was enabled in the
sites-enabled folder and the links are there. Can you help me figure out what is wrong?
Thank you
Reply
Linerd says:
May 14, 2012 at 9:07 PM
What is the content of your /etc/hosts file? You should have a line that looks like:
ans says:
May 15, 2012 at 7:01 AM
hey sorry, I have been waiting and didn't even think about just refreshing the page to see your
reply.
this is the content of my hosts:
127.0.0.1 localhost
127.0.0.1 localhost site1
127.0.0.1 localhost site2
I did that after reading this comment here:
" Matt says:
January 10, 2012 at 8:33 AM
"Should the first line in /etc/hosts read "127.0.0.1 localhost site1 site2" for instance?"
No, each site requires a new line so instead of "127.0.0.1 localhost site1 site2" it should be:
127.0.0.1 localhost site1
127.0.0.1 localhost site2
You just repeat the steps you did to create site1 in order to create site2, site3, etc. except you add a
line in /etc/hosts for each new site. Also, your site name can be pretty much any name you want (it
doesn't have to be "site1"). "
I change the configuration to localhost site1 site2 and it it working! I have been on ths simple
line for the hole night!!! crasy !
Thank you
Reply
ans says:
May 16, 2012 at 10:41 AM
Hey Linerd,
It looks like things are getting worse for me. This solution I posted worked fine Yesterday, now my browsers
can't display any local pages or phpMyAdmin any more... what's going on? thx
Reply
Linerd says:
May 16, 2012 at 11:26 AM
Check you /etc/hosts file. Sometimes Network Manager likes to overwrite this file, so you might need
converted by Web2PDFConvert.com
to make the changes again. If that is the case, you could try making the file immutable so it can't be
overwritten by the system. So make your changes to the file, then
ans says:
May 17, 2012 at 6:10 PM
Linerd,
My problem was much simpler. Apache just stop running and I didn't know. sudo service
apache2 start was enough! Thanks again.
Reply
Ed says:
May 16, 2012 at 11:38 AM
WONDERFUL!
I had so many issues doing this on Natty 11.04, however on Pp 12.04 and your tutorial it works fine.
BIG BIG thank you!
Reply
Older CommentsLeave
a Reply
Your email address will not be published. Required fields are marked *
Name *
Email *
Website
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title="">
<acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em>
<i> <q cite=""> <strike> <strong>
Post Comment
COPYRIGHT 2009 - 2011 TUX TWEAKS.
converted by Web2PDFConvert.com