<分区>
我有 Centos 服务器并使用 PHP 和 Yii 框架。我在 /etc/httpd/conf/httpd.conf
中有以下配置:
Alias /test "/var/www/test/"
<Directory "/var/www/test/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
当我在浏览器中指向 ip.ip.ip.ip/test
时,它会在 /var/www/test/
中显示我的项目,这很好。现在我想使用以下 URL 访问我在 /var/www/test/
中的项目:
ip.ip.ip.ip:8080
这可能吗?
最佳答案
您可以为此使用 Apache 虚拟主机机制:
Listen 8080
<VirtualHost *:8080>
DocumentRoot /var/www/test
<Directory />
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
关于php - 如何指向一个URL :PORT to specific directory in apache,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16732729/