我已经在运行Ubuntu 18和Apache的VPN上设置了Laravel项目。我的主站点工作正常,但是我的所有子域都无法工作。我正在尝试设置通配符dns,但即使是静态通配符也无法正常工作。
chrome出现错误:
“找不到服务器的IP地址”和“ DNS_PROBE_FINISHED_NXDOMAIN”,firefox和safari表示他们找不到服务器。
我尝试手动和自动设置它(使用Virtualmins网站选项>“网站是否匹配所有子域?”。这也只是创建一个通配符dns,并将其也添加到apache服务器文件中。
没有任何效果。有人对此有解决方案吗?
这是我的etc / apache2 / sites-available / myDomain.com.conf
<VirtualHost 123.12.123.12:80>
SuexecUserGroup "#1000" "#1000"
ServerName myDomain.com
ServerAlias www.myDomain.com
ServerAlias mail.myDomain.com
ServerAlias webmail.myDomain.com
ServerAlias admin.myDomain.com
ServerAlias *.myDomain.com
DocumentRoot /home/myDomain/public_html/public
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/public>
Options -Indexes +IncludesNOEXEC +FollowSymlinks -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 ^(.*) myDomain.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.myDomain.com
RewriteRule ^(.*) 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>
IPCCommTimeout 31
<Location /git>
DAV on
AuthType Basic
AuthName myDomain.com
AuthUserFile /home/myDomain/etc/git.basic.passwd
Require valid-user
Satisfy All
RedirectMatch ^/git$ myDomain.com/git/gitweb.cgi
RedirectMatch ^/git/$ myDomain.com/git/gitweb.cgi
RewriteEngine off
AddHandler cgi-script .cgi
</Location>
<Location /git/myDomain.git>
Require user myDomain
</Location>
</VirtualHost>
和DNS记录:
$ttl 38400
@ IN SOA test.vpshosting24.com. root.test.vpshosting24.com. (
1555699705
10800
3600
604800
38400 )
@ IN NS test.vpshosting24.com.
test.vpshosting24.com. IN A 123.12.123.12
myDomain.com. IN A 123.12.123.12
www.myDomain.com. IN A 123.12.123.12
ftp.myDomain.com. IN A 123.12.123.12
m.myDomain.com. IN A 123.12.123.12
localhost.myDomain.com. IN A 127.0.0.1
webmail.myDomain.com. IN A 123.12.123.12
admin.myDomain.com. IN A 123.12.123.12
mail.myDomain.com. IN A 123.12.123.12
mail.myDomain.com. IN MX 5 myDomain.com.
myDomain.com. IN TXT "v=spf1 a mx a:myDomain.com ip4:123.12.123.12 ip4:123.12.123.12 ip6:13d3:321:8:6:2:2f32:2324:ece0 ?all"
*.myDomain.com. IN A 123.12.123.12
@ IN A 123.12.123.12
当我在终端上运行dig test.myDomain.com @ 127.0.0.1时:
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> test.myDomain.com @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59596
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
; COOKIE: 47a4b5f1cd262wr4353af494545cba2354364c6f316d347c17 (good)
;; QUESTION SECTION:
;test.myDomain.com. IN A
;; ANSWER SECTION:
test.myDomain.com. 38400 IN A 123.12.123.12
;; AUTHORITY SECTION:
myDomain.com 38400 IN NS test.vpshosting24.com.