LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-16-2011, 10:36 PM   #1
r2g2btru
LQ Newbie
 
Registered: Jan 2011
Distribution: Fedora 14
Posts: 26

Rep: Reputation: 0
Virtual hosts on LAMP server not going to right directory externally


I created LAMP server with a wordpress site. I created a sites-available file for the wordpress file pointing to the wordpress directory. Within my server it goes to the site properly. However I also made this server a DNS server, had another test pc use it as a DNS server and it only got the default apache page unless I added /wordpress to the url which makes it point to the directory within /var/www/ that it belongs, but then the wordpress links don't work and this is not what I want it to do anyway. I do not understand why it is working properly internally but not externally. It makes me think maybe the sites-available file is not allowing outside access appropriate permission to use it or something. Can somebody please point me in the right direction I have been working on this for weeks and I am starting to get really frustrated with it. Tell me what config files can help you figure out my issue. Also I eliminated the default index.html file so it wouldn't use it, then placed the index.php file from wordpress in /var/www/ root but in that configuration it doesn't load anything by default but will still work if you point to /wordpress. I believe I have to make some change to my apache2 configs to allow outside PCs to be pointed to the right root directory for the virtual host like is being done internally, I just don't know where to start. Thank you.

Here is my sites-available config file-
NameVirtualHost www.mysite.local:80

<VirtualHost www.mysite.local:80>
ServerAdmin myname@localhost
ServerName www.mysite.local

DocumentRoot /var/www/wordpress/
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
</Directory>
<Directory /var/www/wordpress/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

Last edited by r2g2btru; 07-17-2011 at 01:53 AM.
 
Old 07-17-2011, 03:21 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Once you've created a vhost file under sites-available (e.g. /etc/apache2/sites-available/mysite.local), you should run:
Code:
a2ensite mysite.local
to create the needed symlinks and of course reload apache.
BTW, there is a /etc/apache2/conf.d/virtual.conf, where NemeVirtualHost is defined and it's better to use:
Quote:
NameVirtualHost *:80
Then in /etc/apache2/sites-available/mysite.local use just:
Code:
<VirtualHost *:80>
...
Regards

Last edited by bathory; 07-17-2011 at 11:50 AM.
 
Old 07-17-2011, 09:01 PM   #3
r2g2btru
LQ Newbie
 
Registered: Jan 2011
Distribution: Fedora 14
Posts: 26

Original Poster
Rep: Reputation: 0
that does not work it instead brings up an error that states the virtualhost is not named. Please somebody help, I'm guessing this is either a DNS issue or it is an issue where the virtual host naming feature is not working. By the way I already used the a2ensite command to enable the site. Also I do not have virtual.conf file in my conf.d directory and when I create it like you said it only brings about that no name for virtual host error.
 
Old 07-17-2011, 11:06 PM   #4
r2g2btru
LQ Newbie
 
Registered: Jan 2011
Distribution: Fedora 14
Posts: 26

Original Poster
Rep: Reputation: 0
I discovered that the issue was that I needed to add a line to my /etc/hosts file that had my ip address paired with the host names I was using.
 
Old 08-18-2011, 02:25 PM   #5
creddle87
LQ Newbie
 
Registered: Aug 2011
Posts: 1

Rep: Reputation: Disabled
i was looking for some in formation on virtual host on server..
Any body here to help me.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot access my other virtual hosts on ubuntu server Logansanoh Linux - Server 4 05-20-2011 09:34 AM
I am confused about best practices for virtual hosts under Debian LAMP setup Mohtek Linux - Server 1 03-15-2009 09:33 PM
Virtual Hosts/Directory Index Forbidden by Rule Alan Powell Linux - Newbie 4 04-26-2004 06:35 AM
Virtual Hosts in Apache Server irclord Linux - Networking 5 09-02-2003 01:29 PM
Question on virtual hosts and CGI-BIN directory cgchris99 Linux - General 9 10-11-2002 11:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration