简体   繁体   English

httpd.conf 中的 documentroot 路径 DirectAdmin ads SUB 到路径

[英]documentroot path in httpd.conf DirectAdmin adss SUB to the path

My laravel sites are hosted at Versio.nl.我的 laravel 站点托管在 Versio.nl。 Recently they did maintenance on the servers and since then my subdomains are down.最近他们对服务器进行了维护,从那时起我的子域就关闭了。

I found a strange set of document roots.我发现了一组奇怪的文档根目录。

In the DirectAdmin panel under custom httpd configurations I added:在我添加的自定义 httpd 配置下的 DirectAdmin 面板中:

|*if !SUB|
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/public|
|*endif|

|*if SUB="demo"|
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/demo/public|
|*endif|

|*if SUB="avn"| 
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/avn/public|
|*endif|

The laravel applications are in these directories. Laravel 应用程序位于这些目录中。

Now I see that in the contents of the httpd.conf the paths changed to:现在我看到在 httpd.conf 的内容中,路径更改为:

<VirtualHost 185.xxx:80 >
    ServerName www.ai.netwerkspel.nl
    ServerAlias www.ai.netwerkspel.nl ai.netwerkspel.nl 
    ServerAdmin webmaster@netwerkspel.nl
    DocumentRoot /home/admin/domains/netwerkspel.nl/public_html/ai/public/ai   <<--------
    ScriptAlias /cgi-bin/ /home/admin/domains/netwerkspel.nl/public_html/ai/public/ai/cgi-bin/
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup admin admin
    </IfModule>
    CustomLog /var/log/httpd/domains/netwerkspel.nl.ai.bytes bytes
    CustomLog /var/log/httpd/domains/netwerkspel.nl.ai.log combined
    ErrorLog /var/log/httpd/domains/netwerkspel.nl.ai.error.log
    <Directory /home/admin/domains/netwerkspel.nl/public_html/ai/public/ai>
        <FilesMatch "\.(inc|php|phtml|phps|php74)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php74/sockets/admin.sock|fcgi://localhost" .inc .php .phtml .php74
            </If>
        </FilesMatch>
    </Directory>
</VirtualHost>

<VirtualHost 185.xxx:443 >
    SSLEngine on
    SSLCertificateFile /usr/local/directadmin/data/users/admin/domains/netwerkspel.nl.cert.combined
    SSLCertificateKeyFile /usr/local/directadmin/data/users/admin/domains/netwerkspel.nl.key
    ServerName www.ai.netwerkspel.nl
    ServerAlias www.ai.netwerkspel.nl ai.netwerkspel.nl 
    ServerAdmin webmaster@netwerkspel.nl
    DocumentRoot /home/admin/domains/netwerkspel.nl/public_html/ai/public/ai   <<--------
    ScriptAlias /cgi-bin/ /home/admin/domains/netwerkspel.nl/public_html/ai/public/ai/cgi-bin/
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup admin admin
    </IfModule>
    CustomLog /var/log/httpd/domains/netwerkspel.nl.ai.bytes bytes
    CustomLog /var/log/httpd/domains/netwerkspel.nl.ai.log combined
    ErrorLog /var/log/httpd/domains/netwerkspel.nl.ai.error.log
    <Directory /home/admin/domains/netwerkspel.nl/public_html/ai/public/ai>
        <FilesMatch "\.(inc|php|phtml|phps|php74)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php74/sockets/admin.sock|fcgi://localhost" .inc .php .phtml .php74
            </If>
        </FilesMatch> 
    </Directory>
</VirtualHost>

<VirtualHost 185.xxxx:80 >
    ServerName www.avn.netwerkspel.nl
    ServerAlias www.avn.netwerkspel.nl avn.netwerkspel.nl 
    ServerAdmin webmaster@netwerkspel.nl
    DocumentRoot /home/admin/domains/netwerkspel.nl/public_html/avn/public/avn    <<--------
    ScriptAlias /cgi-bin/ /home/admin/domains/netwerkspel.nl/public_html/avn/public/avn/cgi-bin/
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup admin admin
    </IfModule>
    CustomLog /var/log/httpd/domains/netwerkspel.nl.avn.bytes bytes
    CustomLog /var/log/httpd/domains/netwerkspel.nl.avn.log combined
    ErrorLog /var/log/httpd/domains/netwerkspel.nl.avn.error.log
    <Directory /home/admin/domains/netwerkspel.nl/public_html/avn/public/avn>
        <FilesMatch "\.(inc|php|phtml|phps|php74)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php74/sockets/admin.sock|fcgi://localhost" .inc .php .phtml .php74
            </If>
        </FilesMatch>
    </Directory>
</VirtualHost>

<VirtualHost 185.xxx:443 >
    SSLEngine on
    SSLCertificateFile /usr/local/directadmin/data/users/admin/domains/netwerkspel.nl.cert.combined
    SSLCertificateKeyFile /usr/local/directadmin/data/users/admin/domains/netwerkspel.nl.key
    ServerName www.avn.netwerkspel.nl
    ServerAlias www.avn.netwerkspel.nl avn.netwerkspel.nl 
    ServerAdmin webmaster@netwerkspel.nl
    DocumentRoot /home/admin/domains/netwerkspel.nl/public_html/avn/public/avn   <<--------
    ScriptAlias /cgi-bin/ /home/admin/domains/netwerkspel.nl/public_html/avn/public/avn/cgi-bin/
    UseCanonicalName OFF
    <IfModule !mod_ruid2.c>
        SuexecUserGroup admin admin
    </IfModule>
    CustomLog /var/log/httpd/domains/netwerkspel.nl.avn.bytes bytes
    CustomLog /var/log/httpd/domains/netwerkspel.nl.avn.log combined
    ErrorLog /var/log/httpd/domains/netwerkspel.nl.avn.error.log
    <Directory /home/admin/domains/netwerkspel.nl/public_html/avn/public/avn>
        <FilesMatch "\.(inc|php|phtml|phps|php74)$">
            <If "-f %{REQUEST_FILENAME}">
                #ProxyErrorOverride on
                AddHandler "proxy:unix:/usr/local/php74/sockets/admin.sock|fcgi://localhost" .inc .php .phtml .php74
            </If>
        </FilesMatch> 
    </Directory>
</VirtualHost>

and configuration check issues warnings:和配置检查发出警告:

AH00112: Warning: DocumentRoot [/home/admin/domains/netwerkspel.nl/public_html/ai/public/ai] does not exist
AH00112: Warning: DocumentRoot [/home/admin/domains/netwerkspel.nl/public_html/ai/public/ai] does not exist
AH00112: Warning: DocumentRoot [/home/admin/domains/netwerkspel.nl/public_html/avn/public/avn] does not exist
AH00112: Warning: DocumentRoot [/home/admin/domains/netwerkspel.nl/public_html/avn/public/avn] does not exist

Can anyone see why all of a sudden the SUB itself is added at then of the paths?任何人都可以看到为什么突然在路径中添加 SUB 本身吗? I indicated with arrows in the code above..我在上面的代码中用箭头表示..

How I turn this back so they point to the right rootdirectories?我如何将其转回以便它们指向正确的根目录?

Solved problem.解决了问题。 Problem was with the Templates.问题出在模板上。

In DirectAdmin -> Custom HTTPD Configurations you click the domainname and then, right under the list of available Tokens you can watch the "Templates".在 DirectAdmin -> Custom HTTPD Configurations 中,单击域名,然后在可用令牌列表下方,您可以查看“模板”。 These appear to be the templates that DirectAdmin uses when constructing the httpd.conf with the virtualhosts as defined by you.这些似乎是 DirectAdmin 在使用您定义的虚拟主机构建 httpd.conf 时使用的模板。

In my case I defined在我的例子中,我定义了

|*if SUB="demo"|
|?DOCROOT=/home/admin/domains/netwerkspel.nl/public_html/demo/public|
|*endif|

And direct Admin translated it into directories like <Directory /home/admin/domains/netwerkspel.nl/public_html/demo/public/demo>直接管理员将其翻译成目录,如 <Directory /home/admin/domains/netwerkspel.nl/public_html/demo/public/demo>

I found that the templates responsible for the translation are:我发现负责翻译的模板是:

 /usr/local/directadmin/data/templates/custom/virtual_host2_sub.conf     
 /usr/local/directadmin/data/templates/custom/virtual_host2_secure_sub.conf     

These can be edited and placed in a custom directory, to point out to DirectAdmin that these are templates to use.这些可以编辑并放置在自定义目录中,以向 DirectAdmin 指出这些是要使用的模板。

First I created the custom folder ( use sudo, access denied otherwise)首先我创建了自定义文件夹(使用 sudo,否则访问被拒绝)

mkdir -p /usr/local/directadmin/data/templates/custom/
chmod 711 /usr/local/directadmin/data/templates/custom/
chown diradmin:diradmin /usr/local/directadmin/data/templates/custom/ -R

and the copy the relevant templates into it:并将相关模板复制到其中:

sudo cp -p virtual_host2_secure_sub.conf custom
sudo cp -p virtual_host2_sub.conf custom

The next step is to edit both the templates in the custom folder.下一步是编辑自定义文件夹中的两个模板。 Find the line that states:找到说明以下内容的行:

|?SDOCROOT=`DOCROOT`/'SUB'|

and change it into并将其更改为

|?SDOCROOT=`DOCROOT`|

Now the templates in DirectAdmin look like:现在 DirectAdmin 中的模板如下所示:

/usr/local/directadmin/data/templates/custom/virtual_host2_sub.conf     *** Custom Template ***
 /usr/local/directadmin/data/templates/custom/virtual_host2_secure_sub.conf     *** Custom Template ***

DirectAdmin will use the Custom templates. DirectAdmin 将使用自定义模板。 After saving the configurations again the subdomains work again!再次保存配置后,子域再次工作!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM