在Apache中配置多个主机,并在不同端口上使用SSL配置多个主机
嗨,我想在不同端口上使用SSL上的同一服务器上运行多个站点,这是我到目前为止所做的。
default-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin [email protected]
ServerName app.example.com
DocumentRoot path_to_project_directory
<Directory path_to_project_directory>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>
</IfModule>
带有上述配置,当我运行 https://aap.example 。 “ nofollow noreferrer”> https://app.example.com:8000 ,因此,为此,我制作了另一个虚拟主机文件。
app.example.com.conf ,
<VirtualHost *:8000>
ServerAdmin [email protected]
ServerName app.example.com
Alias /static/ path_to_project_directory
WSGIPassAuthorization On
WSGIScriptAlias / path_to_project_directory/wsgi.py
WSGIDaemonProcess example_wsgi33 processes=3 threads=15 display-name=example_wsgi33 python-path=path_to_project_directory:path_to_project_directory/venv/lib/python3.9/site-packages
<Directory path_to_project_directory>
WSGIProcessGroup example_wsgi33
WSGIApplicationGroup %{GLOBAL}
DirectoryIndex manage.py
Require all granted
Options -Indexes -MultiViews +SymLinksIfOwnerMatch
Allow from all
</Directory>
<Directory path_to_project_directory>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
但是当我尝试运行 https:/ /app.example.com:8000 它什么也没告诉我,我遇到的错误就像响应太久了。 任何人都知道如何在不同端口上运行站点。 这是我的端口
Listen 80
Listen 8000
Listen 8001
Listen 8002
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
。
Hi i want to run multiple sites on same server with ssl on different ports, here is what i did so far.
default-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin [email protected]
ServerName app.example.com
DocumentRoot path_to_project_directory
<Directory path_to_project_directory>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>
</IfModule>
With above configuration when i run https://aap.example.com on browser it works fine now i want to run same domain on different port with ssl like https://app.example.com:8000, so for this i have made another virtual host file like this.
app.example.com.conf
<VirtualHost *:8000>
ServerAdmin [email protected]
ServerName app.example.com
Alias /static/ path_to_project_directory
WSGIPassAuthorization On
WSGIScriptAlias / path_to_project_directory/wsgi.py
WSGIDaemonProcess example_wsgi33 processes=3 threads=15 display-name=example_wsgi33 python-path=path_to_project_directory:path_to_project_directory/venv/lib/python3.9/site-packages
<Directory path_to_project_directory>
WSGIProcessGroup example_wsgi33
WSGIApplicationGroup %{GLOBAL}
DirectoryIndex manage.py
Require all granted
Options -Indexes -MultiViews +SymLinksIfOwnerMatch
Allow from all
</Directory>
<Directory path_to_project_directory>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
but when i try to run https://app.example.com:8000 it shows me nothing and i'm getting error like took too long to respond..
Anybody has idea how i can run site on different ports.
Here is my ports.conf
Listen 80
Listen 8000
Listen 8001
Listen 8002
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
I have already enabled these ports on my digital ocean firewall
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论