端口 8080 上的虚拟主机 XAMPP 无法正常工作

use*_*349 2 php apache iis xampp virtualhost

我想在 XAMPP 上运行 Vhost 但重定向到端口:8080。这里的问题是我的 IIS 在端口 :80 上运行,Apache 在端口 :8080 上运行,这些是我尝试在虚拟主机上运行我的项目的配置文件:

主机文件

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
    127.0.0.1   www.goviaje.com
Run Code Online (Sandbox Code Playgroud)

httpd-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 *:8080
#
# 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 *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

<VirtualHost *:8080>
   ServerAdmin localhost:8080
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost:8080
</VirtualHost>

<VirtualHost *:8080>
  DocumentRoot "C:/xampp/htdocs/goviaje/"
  ServerName www.goviaje.com:8080
  ServerAlias goviaje.com:8080
 <Directory "C:/xampp/htdocs/goviaje">
   Options Indexes FollowSymLinks
   AllowOverride All
   Order allow,deny
   Allow from all
 </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

启用了 httpd.conf 中的所有必要模块

好的,当我在浏览器中输入“www.goviaje.com”时,它会将我发送到 IIS 主页(localhost:80),我需要转到localhost:8080/goviaje/

有人可以帮助我吗?

小智 6

您必须www.goviaje.com:8080用作网站 URL 才能访问 Apache,因为默认 HTTP 端口是 80,因此 IIS 正在为您的请求提供服务。此外,当然,您可以将 IIS 配置为转发代理。