[英]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.