0

A conf file of httpd-vhosts.conf:

<VirtualHost *:80>
   DocumentRoot "C:\Apache24\htdocs\lsapp\public"
  ServerName lsapp.test
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:\Apache24\htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:\Apache24\htdocs\codeigniter\bladetemplate\public"
    ServerName bladetemplate.test
</VirtualHost>

httpd-conf file

ServerRoot "c:/Apache24"

Listen 80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_core_module modules/mod_authn_core.so

LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authz_core_module modules/mod_authz_core.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so

LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so

LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin admin@example.com

ServerName localhost

<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "c:/Apache24/htdocs/lsapp/public"
<Directory "c:/Apache24/htdocs/lsapp/public">

    Options Indexes FollowSymLinks

    AllowOverride All

    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.php
</IfModule>

<Files ".ht*">
    Require all denied
</Files>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    CustomLog "logs/access.log" common

</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "c:/Apache24/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule headers_module>
    RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>
    TypesConfig conf/mime.types

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

</IfModule>

<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

LoadModule php5_module "c:/php/php5apache2_4.dll"

<IfModule php5_module>

    PHPIniDir "C:/php"
    AddHandler application/x-httpd-php .php
</IfModule>

This is an hosts file of window system:

127.0.0.1       localhost
127.0.0.1       lsapp.test
127.0.0.2       bladetemplate.test

When i open up my browser write the bladetemplate.test host. it fetches the lsapp.test data. what wrong with i can't figure out check out my conf files above.All my ServerName and DocumentRoot is right.I am developing a laravel application. i have checked my files and folders correctly.

kubanczyk
  • 13,812
  • 5
  • 41
  • 55

1 Answers1

0

Are you not forgetting the <Directory> directive for bladetemplate.test? Try add this:

<Directory "C:\Apache24\htdocs\codeigniter\bladetemplate\public">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
Netum
  • 461
  • 4
  • 5
  • in httpd.conf file? – seekingKnowledge Apr 23 '18 at 05:12
  • oh god. now it is not giving me a permission to access the file(403 forbidden) – seekingKnowledge Apr 23 '18 at 08:24
  • Yes, https.conf, or in vhost file, but outside VirtuaHost Directive. About 403 error, you need to change permissions of file and/or directory – Netum Apr 23 '18 at 10:07
  • Just an idea, is there any file inside this folder? (Like, index.htm or index.php)? – Netum Apr 23 '18 at 10:17
  • in `/htdocs` yeah there is i delete it and it is not working. even i put these two host directory in `~/virtul` but did not work. – seekingKnowledge Apr 24 '18 at 07:33
  • and it's sh0wing me this error:`Warning: require(C:\Apache24\htdocs\virtual\bladetemplate\public/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Apache24\htdocs\virtual\bladetemplate\public\index.php on line 24` – seekingKnowledge Apr 24 '18 at 07:34
  • directory is right there and apache can't load it. – seekingKnowledge Apr 24 '18 at 07:35
  • Sounds like this error is not about web server, but about your application now. Verify if the file c:\Apache24\htdocs\virtual\bladetemplate\vendor\autoloud.php and/or c:\apache24\htdocs\virtual\bladetemplate\public\index.pho – Netum Apr 25 '18 at 10:11
  • Now that I see, on Httpd.conf you refer to codeigniter’s directory inside htdocs, but the error refer to virtual’s subdirectory. Verify if the paths are equals, and exists. – Netum Apr 25 '18 at 10:20
  • you are right. https://stackoverflow.com/questions/49954169/serving-wrong-servername/50016971#50016971 – seekingKnowledge Apr 26 '18 at 07:15
  • @seekingKnowledge ok, problem solved! – Netum Apr 26 '18 at 23:16