如何更改xampp的端口
发布网友
发布时间:2022-04-28 00:37
我来回答
共2个回答
懂视网
时间:2022-04-28 04:59
具体方法:
(学习视频推荐:php视频教程)
到xampp的安装目录下,点击进入apacheconf下,使用编辑器打开“httpd.conf”文件
将 Listen 80 改为 Listen 8081
将 ServerName localhost:80 改为 ServerName localhost:8081
在XAMPP Control Panel中重新启动apache服务
热心网友
时间:2022-04-28 02:07
1
找到C:\Windows\System32\drivers\etc 下的
hosts文件
增加以下代码:
127.0.0.1 localhost
127.0.0.1 localhost:8080
2
找到c:\xampp\apache\conf 下的
httpd.conf
将Include conf/extra/httpd-v前面的#去掉变成
Include conf/extra/httpd-vhosts.conf
增加两行代码
Listen 8080
NameVirtualHost localhost:8080
3
找到c:\xampp\apache\conf\extra下的
httpd-vhosts.conf增加代码
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "c:/xampp/htdocs">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.php
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8080>
DocumentRoot "c:/xampp/htdocs/tpshop"
ServerName localhost:8080
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "c:/xampp/htdocs/tpshop">
Options Indexes FollowSymLinks
DirectoryIndex index.html index.php
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
4
重启Apache
5
地址栏输入
localhost可以访问xampp
地址栏输入
localhost:8080
可以访问tpshop