繁体   English   中英

Xampp Vhost无法与其他端口一起使用

[英]Xampp Vhost not working with different port

我在xampp中创建了一个虚拟主机。 我无法使用端口80,所以我正在使用端口8080。然后我调用servername:8080来获取index.php。 它工作正常,但我无法进行ajax调用,然后发生错误。 怎么了?

虚拟主机

 <VirtualHost 127.0.0.1:8080>
   DocumentRoot "somepath"
   ServerName servername
   <directory "somepath">
      usual stuff here
   </directory> 
 </VirtualHost>

调用index.php

http://servername:8080

错误ajax

GET http://servername:8080/contact.html 404 (Not Found) 
jquery-2.1.0.min.js:4l.cors.a.crossDomain.send jquery-2.1.0.min.js:4o.extend.ajax 
jquery- 2.1.0.min.js:4o.(anonymous function) jquery-2.1.0.min.js:4start_loading
 main.js:516click_internal_link main.js:547(anonymous function) 
main.js:670o.event.dispatch jquery-2.1.0.min.js:3r.handle

尝试以下操作:(通过xampp面板打开Apache配置,最后添加以下内容:)

Setting Up Your VHOST
    =====================

    The following is a sample VHOST you might want to consider for your project.

    NameVirtualHost 127.0.0.1:80

VHOST for Windows
=====================

<VirtualHost *:80>
   DocumentRoot "C:/xampp/htdocs/..." 
   ServerName localhost

   # This should be omitted in the production environment
   #SetEnv APPLICATION_ENV development
   #SetEnv APPLICATION_ENV production

   <Directory "C:/xamp/htdocs/...">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>

AND:在您的Windows主机中

   C:\WINDOWS\system32\drivers\etc
    Edit hosts:

    127.0.0.1 localhost

祝好运 ;)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM