Jun*_*ior 7 apache xampp httpd.conf vhosts laravel
我在Windows 7 Pro上运行XAMPP.我正在尝试设置虚拟主机,以便当我使用"dev.app"作为域时,我直接进入laravel安装的公共文件夹.
Laravel位于 F:/xampp/htdocs/dev/public
我打开了httpd-vhosts.conf位于的文件F:\xamp\apache\conf\extra\https-vhosts.conf
用这个替换了一切
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# 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.
#
<VirtualHost localhost>
DocumentRoot "F:/xampp/htdocs/"
ServerAdmin admin@localhost
<Directory "F:/xampp/htdocs/">
Options Indexes FollowSymLinks
AllowOverride all
</Directory>
</VirtualHost>
# Development
<VirtualHost dev.app>
DocumentRoot "F:/xampp/htdocs/dev/public"
ServerAdmin admin@localhost
<Directory "F:/xampp/htdocs/dev/public">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
然后我打开了我的主机文件,C:\Windows\System32\drivers\etc并添加了更改localhost行,看起来像这样
127.0.0.1 localhost dev.app
127.0.0.1 127.0.0.1
Run Code Online (Sandbox Code Playgroud)
但是,当我在浏览器中访问dev.app时,我收到此错误
无法连接
Firefox无法在app.dev上建立与服务器的连接.
Run Code Online (Sandbox Code Playgroud)The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
我在这里错过了什么?我做错了什么?
注意:我在更改vhosts文件后重新启动了Apache.另外,我更新了laravel的config文件夹中的app.php文件,以便http://dev.app在url中有值.
添加http:// ....后更新网站解析但图像未显示.
Rig*_*lly 11
hosts文件应如下所示,以便可以在IPV4和IPV6网络上找到它
127.0.0.1 localhost dev.app
::1 localhost dev.app
Run Code Online (Sandbox Code Playgroud)
如果您在httpd-vhosts.conf中使用Apache 2.4.x这一行
NameVirtualHost *:80
Run Code Online (Sandbox Code Playgroud)
Apache 2.4不再需要或不允许使用.
vhost文件看起来应该是这样的,你混合了Apache 2.2和2.4语法,只要你mod_access_compat激活了它们,你就不应该混合它们,2.4语法更好.你也错过了其他一些有用的零碎
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/"
ServerAdmin admin@localhost
ServerName localhost
<Directory "F:/xampp/htdocs/">
Options Indexes FollowSymLinks
AllowOverride all
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "F:/xampp/htdocs/dev/public"
ServerAdmin admin@localhost
ServerName dev.app
ServerAlias www.dev.app
<Directory "F:/xampp/htdocs/dev/public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
# if you want access from other pc's on your local network
#Require ip 192.168.1
# Only if you want the world to see your site
#Require all granted
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
26837 次 |
| 最近记录: |