【问题标题】:Run two php application in two different ports in apache在 apache 的两个不同端口中运行两个 php 应用程序
【发布时间】:2012-02-01 08:34:15
【问题描述】:

我在同一台机器上有两个示例应用程序。 它是 PHP。 我需要开发支持跨域 cookie 的应用程序。 所以,现在我正在尝试在 apache 服务器的不同端口上运行两个应用程序。所以为此我更改了 httpd.conf 中的端口号。 就像我添加的 听 8080 而且我不了解

VirtualHost *:80  
ServerAdmin webmaster@dummy-host.example.com  
 DocumentRoot /www/docs/dummy-host.example.com      
ServerName dummy-host.example.com   
ErrorLog logs/dummy-host.example.com-error_log  
CustomLog logs/dummy-host.example.com-access_log common

请告诉我如何为我的第二个端口 8080 添加它。 我从浏览器以 xxx.xx.x.xx/First/Cookies 运行我的应用程序。 我试过 xxx.xx.x.xx:80/First/Cookies.----这很好, 我如何为我的第二个应用程序尝试 8080。 请指导我。

【问题讨论】:

    标签: php apache httpd.conf


    【解决方案1】:

    这应该是您需要的最低限度。随意添加其他有用的指令。

    Listen 80
    <VirtualHost *:80>
            DocumentRoot /home/x/z/
            ... the usual stuff ...
    </VirtualHost>
    
    Listen 20117
    <VirtualHost *:20117>
            DocumentRoot /home/x/y/public_html
    </VirtualHost>
    

    【讨论】:

      【解决方案2】:
      <VirtualHost SERVERNAME:8080>
      ServerAdmin webmaster@another-host.example.com
      ServerName SERVERNAME:8080
      DocumentRoot "/www/docs/another-host.example.com"
      ErrorLog logs/another-host.example.com-error_log  
      CustomLog logs/another-host.example.com-access_log common
      

      在 httpd.conf 文件中也加入这一行

      Listen 8080

      <Directory "/www/docs/another-host">
      Options All
      AllowOverride All
      Order allow,deny
      Allow from all
      

      也添加这个

      【讨论】:

      • 谢谢你的回复..我是新手..所以如果我很傻,请不要找错..我需要的只是解释其中包含的内容以及所有内容的位置进行编辑以使我的应用程序也可以在端口 8080 中工作。 ServerAdmin webmaster@dummy-host.example.com DocumentRoot /www/docs/dummy-host.example.com ServerName dummy-host.example.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host。 example.com-access_log common
      • 请帮我做这件事,因为我对此很感兴趣。
      • 我添加了 Listen:8080 和 ServerName SERVERNAME:8080 。谢谢你的回复。我通过随后的阅读得到了你的答案。
      猜你喜欢
      • 2015-11-07
      • 1970-01-01
      • 1970-01-01
      • 2020-04-02
      • 1970-01-01
      • 1970-01-01
      • 2023-01-19
      • 1970-01-01
      • 2015-12-05
      相关资源
      最近更新 更多