WordPress portal not accessible from intranet

I’m trying to build a portal for my organization, using WordPress.
I have installed windows server 2008 R2, Wampserver 2.5 and the WP 3.9.1.
I followed the Wampserver’s guide to setting a virtual host for the site.

On the server machine everything works ok. Localhost at the address bar shows Wamp’s main page and the link to the site shows only the site’s name (without localhost) and when I click it it loads ok.

Read More

The problem is when trying to access it form a client machine on the intranet.
When writing the server machine’s name in the address bar I get the Wamp’s main page without a problem.

The link to the site shows only the site’s name and when I click it I get an error message saying the browser could not find a server at that address.

When I manually write in the address bar the server machine’s name / the site’s name I do get to the site but it’s broken – onlythe text shows.

What is wrong with my settings?

This is the relevant part of httpd.conf:

<Directory "c:/wamp/www/">
  Options Indexes FollowSymLinks
  AllowOverride all
</Directory>

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

And this is the httpd-vhosts.conf file:

 <VirtualHost *:80>
     DocumentRoot "c:/wamp/www"
     ServerName localhost
     ServerAlias localhost
     <Directory  "c:/wamp/www">
        AllowOverride All
        Require all granted
     </Directory>
 </VirtualHost>

 <VirtualHost *:80>
    DocumentRoot "c:/wamp/www/hista-portal"
    ServerName hista-portal
    <Directory  "c:/wamp/www/hista-portal">
       AllowOverride All
        Require all granted
    </Directory>
 </VirtualHost>
  • This is a continuation of another question I asked, but since the situation has changed, with the help of RiggsFolly, and there were many edits it was too complicated to continue there and I thought it would be best to start a new one. I hope I’m not breaking the site’s rules.

Related posts

Leave a Reply

2 comments

  1. Ok,

    Now there is a number of ways of getting you running and a right way.

    Quick and very dirty way:

    Apache treats the first VHOST in the vhost file as the default, which is why currently you are getting to the WAMPServer homepage and not your WP site. So you could just reverse the order of the VHOST definitions, like this :-

    <VirtualHost *:80>
        DocumentRoot "c:/wamp/www/hista-portal"
        ServerName hista-portal
        <Directory  "c:/wamp/www/hista-portal">
           AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
         DocumentRoot "c:/wamp/www"
         ServerName localhost
         ServerAlias localhost
         <Directory  "c:/wamp/www">
            AllowOverride All
            Require local
         </Directory>
    </VirtualHost>
    

    Now when you use the routers WAMP ip address you will get to the WP site.

    Much better way

    Get a free account with DYNDNS or NOIP, there are others.

    This will let you create a pseudo domainname something like hista-portal@dyndns.net

    Then you create a new Virtual Host definition with that as the Server name like so :-

    <VirtualHost *:80>
         DocumentRoot "c:/wamp/www"
         ServerName localhost
         ServerAlias localhost
         <Directory  "c:/wamp/www">
            AllowOverride All
            Require local
         </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        DocumentRoot "c:/wamp/www/hista-portal"
        ServerName hista-portal
        <Directory  "c:/wamp/www/hista-portal">
           AllowOverride All
            Require local
            # maybe also allow access from your local lan
            Require ip 192.168.1  
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
        DocumentRoot "c:/wamp/www/hista-portal"
        ServerName hista-portal.dyndns.net
        <Directory  "c:/wamp/www/hista-portal">
           AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    

    Note I have made the localhost Require local so any accidental access will get an error returned, this helps stop drive by sniffing on your site by people who just use an ip address.

    Remember you are using Name Based Virtual Hosting so Apache really wants to see a name sent by the browser that matches one of the ServerNames it has in its Virtual Host definitions.

  2. Problem solved.

    Well, kinda.

    In the WordPress site settings, I added to the site URL the server machine’s name at the begining.
    Now, on a client machine, when I write at the address bar the sever machine’s name / site name, I get to the site and it works perfectly.
    Before, I just got text cause all the links to the images were wrong.

    The link in the main Wamp site is still wrong but I don’t really need it.
    I’m gonna give the portal users the direct link to the site anyway.