Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

HTTPD.CONF : directory inaccessible

Posted on 2010-09-23
17
Medium Priority
?
419 Views
Last Modified: 2012-05-10
Hello, I have several domain on my server, I configured the virtual host like that:
<VirtualHost *>
    ServerAdmin no@email.me
    DocumentRoot "../www/domain1"
    ServerName www.domain1.com
    ServerAlias domain1.com
</VirtualHost>

My directories are like that:
root/apache/
root/www/domain1
and I would like root/www to be accessible throught the ip of my server but I can't access nor 1.2.3.4/www nor 1.2.3.4/www/domain1

What must I change ?
0
Comment
Question by:Greg2FS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 2
  • +1
17 Comments
 
LVL 6

Expert Comment

by:Ryan Smith
ID: 33747347
for document root use the whole path, not ../
0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33747524
Doesn't change anything...
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33747574
In addition, if "root/www/" is your web root, in your browser you would use "http://1.2.3.4/",  not "http://1.2.3.4/www" for the web site.  The directory that your web site is in is not part of the web address.  "domain.com" is going to be "http://domain.com/".
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 1

Author Comment

by:Greg2FS
ID: 33747673
I uderstand that, it's not the problem, I think maybe it's <directory> misconfiguration...
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33747816
I think so.  <VirtualHost *> should point to the web root for Apache.  What OS are you running on?  Different systems use different configurations.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33747823
And what do you get at "http://localhost/"?
0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33747939
I am under windows.
With local host I get the first domain.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33748566
"With local host I get the first domain."  Good, that's what you should get.

Did you install Apache yourself or did you use WAMP or XAMPP?
0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33748711
xampp, everything was working but I added a domain, and something was wrong, I started modifying the configuration, and now I am a bit lost...
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 33748924
I would recommend that your save your project to another directory.  Then remove XAMPP and delete the directories.  Then reinstall it.  Make sure the basics are working before you change things.  Also make a copy of the configuration files before you change them.  That way you can put a working copy back if something stops working.
0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33751897
OK, I followed you advice, I have a (certainly)small issue, all my php script show a blank page, I use ini_set("display_errors","1");
0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33751910
forget, I didn't uncommented my ini_set("display_errors","1"); now I see the error...
0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33752373
Now domains work but I can't still access any folder throught the ip...
0
 
LVL 15

Expert Comment

by:samri
ID: 33753196
hi,

anything in the server error log?

For virtual hosting, the first configured virtual host would be the default for any request not matcching any vhosts.  The matching will be done against ServerName or ServerAlias directive in the corresponding Vhost container.



0
 
LVL 1

Author Comment

by:Greg2FS
ID: 33753277
Nothing in server logs.
I found a trick, I added a virtualhost with the ip as servername now it works.
Thanks maybe I have to add the ip as default server name..
0
 
LVL 15

Accepted Solution

by:
samri earned 2000 total points
ID: 33755080
hi gref,

the fact that no logs is visible would be related to how the logging is happening in Virtualhost setup.  I am not sure if each logging directive needs to be configured withiin each Vhost, and those that do not have the directive would not be logged.  

Honestly, I didnt pay much attention to this. :)

However, I can verify that, the matching on the client request (http://whatever/path.html), would be matched against the ServerName, and ServerAlias directive in the Vhosts container.  If ip address is used, and none of the Vhost has this configured, the first defined Vhost would be used.

To verify the Vhost order, you could do: (on Unix).

[root@apache html]# httpd -S
[root@apache html]# httpd  -t -D DUMP_VHOSTS
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:8443         apache.domain.net (/etc/httpd/conf.d/ssl.conf:77)
*:80                   is a NameVirtualHost
         default server localhost (/etc/httpd/conf/vhost.conf:7)
         port 80 namevhost localhost (/etc/httpd/conf/vhost.conf:7)
         port 80 namevhost wiki (/etc/httpd/conf/vhost.conf:34)
         port 80 namevhost webmin-apache (/etc/httpd/conf/vhost.conf:41)
         port 80 namevhost nms-apache (/etc/httpd/conf/vhost.conf:48)
         port 80 namevhost nagios (/etc/httpd/conf/vhost.conf:55)
         port 80 namevhost router (/etc/httpd/conf/vhost.conf:62)
         port 80 namevhost reporter (/etc/httpd/conf/vhost.conf:70)
         port 80 namevhost gallery (/etc/httpd/conf/vhost.conf:78)
Syntax OK

0
 
LVL 1

Author Closing Comment

by:Greg2FS
ID: 33873968
Not really had solution...
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question