我们假设我有Apache HTTP Server,一个ip地址,我没有任何域名。我的问题是如何在相同的IP但不同的端口上运行两个Web应用程序。
例如:
所以我可以通过在浏览器的地址行输入IP地址和端口号来访问这两者。据我所知,它被称为基于IP的虚拟主机。
答案 0 :(得分:1)
在Apache / conf的httpd.conf文件中,你必须创建如下的VirtualHosts:
Listen 80
Listen 81
<Directory />
AllowOverride none
Require all granted
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<VirtualHost IPAddress:80>
ServerName localhost:80
WSGIScriptAlias / "C:/var/www/GP/GP/wsgi.py"
Alias /static/ "C:/var/www/GP/static/"
Alias /templates/ "C:/var/www/GP/templates/"
<Directory "C:/var/www/GP/static">
Require all granted
</Directory>
<Directory "C:/var/www/GP/GP">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
<VirtualHost IPAddress:81>
ServerName localhost:81
WSGIScriptAlias / /var/www/adminSVNProject/adminSVNProject/wsgi.py
Alias /static/ /var/www/adminSVNProject/static/
Alias /templates/ /var/www/adminSVNProject/templates/
<Directory /var/www/adminSVNProject/static>
Require all granted
</Directory>
<Directory /var/www/adminSVNProject/adminSVNProject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
WSGIPythonPath /var/www/GP;/var/www/adminSVNProject;
如果您的文件位于C:var / www
希望它可以帮到你。