简体   繁体   English

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

[英]Xampp Vhost not working with different port

I created a virtual host in xampp. 我在xampp中创建了一个虚拟主机。 I cannot use port 80 so I'm using port 8080. I then call servername:8080 to get the index.php. 我无法使用端口80,所以我正在使用端口8080。然后我调用servername:8080来获取index.php。 It works fine but I cannot do an ajax call, then an error occurs. 它工作正常,但我无法进行ajax调用,然后发生错误。 What is wrong? 怎么了?

vhost 虚拟主机

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

Call index.php 调用index.php

http://servername:8080

Error ajax 错误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

Try this: (open by xampp panel the Apache config and in the end add the following:) 尝试以下操作:(通过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 this: in your windows hosts AND:在您的Windows主机中

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

    127.0.0.1 localhost

Good luck ;) 祝好运 ;)

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

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