/etc/hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
# 138.xx.xx.xx is my server ip
138.xx.xx.xx mydomain.com
/etc/apache2/ports.conf
Listen 80
Listen 443
/etc/apache2/sites-enabled/mydomain.com.conf
<VirtualHost *:80>
SuexecUserGroup "#1003" "#1003"
ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAlias mail.mydomain.com
ServerAlias webmail.mydomain.com
ServerAlias admin.mydomain.com
DocumentRoot /home/mydomain/public_html
ErrorLog /var/log/virtualmin/mydomain.com_error_log
CustomLog /var/log/virtualmin/mydomain.com_access_log combined
ScriptAlias /cgi-bin/ /home/mydomain/cgi-bin/
ScriptAlias /awstats/ /home/mydomain/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/mydomain/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php7.2
FCGIWrapper /home/mydomain/fcgi-bin/php7.2.fcgi .php
FCGIWrapper /home/mydomain/fcgi-bin/php7.2.fcgi .php7.2
</Directory>
<Directory /home/mydomain/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mydomain.com
RewriteRule ^(.*) https://mydomain.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mydomain.com
RewriteRule ^(.*) https://mydomain.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php7.2
php_admin_value engine Off
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "mydomain.com statistics"
AuthType Basic
AuthUserFile /home/mydomain/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/mydomain/public_html
<Location /dav>
DAV on
AuthType Basic
AuthName "mydomain.com"
AuthUserFile /home/mydomain/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php7.2
RewriteEngine off
</Location>
</VirtualHost>
<VirtualHost 138.68.92.84:443>
SuexecUserGroup "#1003" "#1003"
ServerName mydomain.com
ServerAlias www.mydomain.com
ServerAlias mail.mydomain.com
ServerAlias webmail.mydomain.com
ServerAlias admin.mydomain.com
DocumentRoot /home/mydomain/public_html
ErrorLog /var/log/virtualmin/mydomain.com_error_log
CustomLog /var/log/virtualmin/mydomain.com_access_log combined
ScriptAlias /cgi-bin/ /home/mydomain/cgi-bin/
ScriptAlias /awstats/ /home/mydomain/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/mydomain/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddHandler fcgid-script .php
AddHandler fcgid-script .php7.2
FCGIWrapper /home/mydomain/fcgi-bin/php7.2.fcgi .php
FCGIWrapper /home/mydomain/fcgi-bin/php7.2.fcgi .php7.2
</Directory>
<Directory /home/mydomain/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mydomain.com
RewriteRule ^(.*) https://mydomain.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mydomain.com
RewriteRule ^(.*) https://mydomain.com:10000/ [R]
RemoveHandler .php
RemoveHandler .php7.2
php_admin_value engine Off
FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "mydomain.com statistics"
AuthType Basic
AuthUserFile /home/mydomain/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/mydomain/public_html
<Location /dav>
DAV on
AuthType Basic
AuthName "mydomain.com"
AuthUserFile /home/mydomain/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php7.2
RewriteEngine off
</Location>
SSLEngine on
SSLCertificateFile /home/mydomain/ssl.cert
SSLCertificateKeyFile /home/mydomain/ssl.key
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
</VirtualHost>
我将网络隐藏在 Cloudflare 后面
然后重新启动 Apache
/etc/init.d/apache2 reload
我访问 mydomain.com,它显示
Forbidden
You don't have permission to access this resource.
欢迎您发表评论