Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Django + Apache2.4 + SSL conf
<VirtualHost *:443>
ErrorLog /home/<User_Name>/MyProject/logs/error.log
CustomLog /home/<User_Name>/MyProject/logs/access.log combined
WSGIScriptAlias / /home/<User_Name>/MyProject/MyProject/wsgi.py
Alias /static/ /home/<User_Name>/MyProject/static/
Alias /templates/ /home/<User_Name>/MyProject/templates/
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/server.crt
SSLCertificateKeyFile /etc/apache2/ssl/server.key
<Directory /home/<User_Name>/MyProject>
Options FollowSymLinks
Order deny,allow
Require all granted
</Directory>
<Directory /home/<User_Name>/MyProject/MyProject>
<Files wsgi.py>
Order deny,allow
# 限制所有人存取 包括本機
Require all denied
# 開放所有人存取
# Allow from all
# 開放本機器存取
Require ip 127.0.0.1
# 開放其他 IP 或 網段存取
# Require 10.0.0.1 192.168 172
</Files>
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment