0

I have tow virtualhost but when i tried to access to them they keep showin me the default page for apache ... but when i add the directory of projet for exp myvirtualhost.com/mydiroctory it works And here is what i have in conf. part

> NameVirtualHost ***.**.**.**:81 
 NameVirtualHost ***.**.**.**:82
> #
> # VirtualHost example:
> # Almost any Apache directive may go into a VirtualHost container.
> # The first VirtualHost section is used for all requests that do not
> # match a ServerName or ServerAlias in any <VirtualHost> block.
> #
> #LoadModule proxy_module modules/mod_proxy.so
> #ProxyRequests On 
  <VirtualHost ***.**.**.**:81>
>        ServerName mrh.star.com.tn
>        <Directory "/var/www/html/mrh">
>         
>        Options +ExecCGI Indexes MultiViews FollowSymLinks
>     AllowOverride None
>     Order allow,deny
>     Allow from all
>         </Directory>
>    
> 
>     ServerAdmin webmaster@star.com.tn
>     DocumentRoot "/var/www/html/mrh"
>     ErrorLog "logs/mrh-error.log"
>     CustomLog "logs/mrh.log" common </VirtualHost>
> 
> <VirtualHost ***.**.**.**:82>
>        ServerName voyage.star.com.tn
>         <Directory "/var/www/html/voyage">
>         
>                
>          Options +ExecCGI Indexes FollowSymLinks MultiViews
>         AllowOverride None
>         Order allow,deny
>         allow from all
>         </Directory>
>     ServerAdmin webmaster@star.com.tn
>     DocumentRoot "/var/www/html/voyage"
> 
>     ErrorLog "logs/voyage-error.log"
>     CustomLog "logs/voyage.log" common </VirtualHost>

it used to work but i dnt know what happen to it , there's nothing in the error logs Any suggestion ?

MonkeyZeus
  • 20,375
  • 4
  • 36
  • 77
Khaled Tlili
  • 29
  • 1
  • 7
  • 1
    You've set them up to listen to port `81` and `82`. Have you tried accessing them on `http://mrh.star.com.tn:81` and `http://voyage.star.com.tn:82`? If you don't want them on different ports (and don't want to specify the port to access them), just add `:80` to all of them. – M. Eriksson Jan 10 '18 at 14:20
  • What version of Apache are you running? Is there a reason for declaring `` instead of simply ``? Are you running Apache 2.3.11 or later because [`NameVirtualHost` has no effect](https://httpd.apache.org/docs/2.4/mod/core.html#namevirtualhost). Is this a production server or are you running this locally on your development machine? – MonkeyZeus Jan 10 '18 at 14:25
  • when i try with http://mrh.star.com.tn:81 it tells me that the URL your asking for dosn't exist ... note that i was workin just by typin http://mrh.star.com.tn and he goes to mydirectory(mrh) .. any suggestion ? thank you . – Khaled Tlili Jan 10 '18 at 14:31
  • Try changing both virtual hosts to ``. If you have them as 81 and 82, you won't be able to access them with just the host name (without the port) and I can't see that it could ever have worked, unless you have some reverse proxy or similar you're not telling us about. When using just the host name: `example.com` it is the same as `example.com:80`. – M. Eriksson Jan 10 '18 at 14:33
  • ***.**.**.**:81 it's only for the post . i use my ip adress. my version of apache is 2.2.4 – Khaled Tlili Jan 10 '18 at 14:34
  • Unless you have multiple IP's and only want your vhost to listen to a specific IP, you can just do `` instead of adding the actual IP. Then it will listen to all interfaces (both public and local, like 127.0.0.1). – M. Eriksson Jan 10 '18 at 14:36
  • i want it to listen to a specific IP , there's somthin that i didn't undrestand.. somtimes when i remove the virtualhost in conf , the URLs still works . somtimes when i access with the ip adress it works fine but with the serverName some files dosn't loaded (failed to load resource) ... i'm not familiar with the apache conf error .they used to work fine for me . – Khaled Tlili Jan 10 '18 at 14:46
  • hope that someone could help me ... to put evrything in the right place .. i'm not working in my locale machin .. i use team viewr to work in my client machin.. the told me they configured the server only for me ... this misconfigured error apeared when i tried to add an .htaccess file but i was able to fix the problem , the strange thing is that i left the project with a missconfigured prob but the next day the project works fine ... any suggestion ? – Khaled Tlili Jan 10 '18 at 14:56

0 Answers0