php - 如何指向一个URL :PORT to specific directory in apache

标签 php apache centos virtualhost

<分区>


想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。

关闭 10 年前

我有 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/

上一篇:vim - 我如何在 centos 6.4 中安装 ctags?

下一篇:cakephp - 如何在nginx中配置cakephp

相关文章:

tomcat - 不能允许 Tomcat6 中的 Java 编码名称

webserver - 在 CentOS 中设置 Web 服务器

php - 提交表单之前清除 URL 中的 GET 变量

php - SilverStripe:如何向另一个网站发出 HTTP 请求?

php - 当涉及的字段之一为 NULL 时,MySQL 错误地允许重复条目

javascript - ng-repeat 随机显示数据

apache - htaccess 重定向以排除某些页面

apache - 将 apache tomcat 从 5.5.xx 升级到更新的 5.5 版本

如果参数包含等号,CGI 脚本不会接收参数

gcc - 如何将centos 6.9中的gcc 4.7.2升级到gcc 4.8