在Apache中以两个不同的端口运行两个PHP应用程序

5
我在同一台机器上有两个样例应用程序。 它们都是PHP编写的。 我需要开发支持跨域cookie的应用程序。 因此,我现在尝试在Apache服务器中的不同端口运行这两个应用程序。为此,我在httpd.conf文件中更改了端口号。 例如,我添加了Listen 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端口。
2个回答

5

这应该是您所需的最基本要求。可以随意添加其他有用的指令。

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

Listen 20117
<VirtualHost *:20117>
        DocumentRoot /home/x/y/public_html
</VirtualHost>

0
<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 - SVC
请帮忙做这个,因为我被卡住了。 - SVC
我已经添加了 "Listen:8080" 和 "<VirtualHost SERVERNAME:8080> ServerName SERVERNAME:8080 </virtualHost>"。感谢您的回复,我通过后续阅读得到了您的答案。 - SVC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接