Info DSM 7.2: Web Station temporary fix for Apache 2.4 VirtualHosts losing ExecCGI and other Options directives

Currently reading
Info DSM 7.2: Web Station temporary fix for Apache 2.4 VirtualHosts losing ExecCGI and other Options directives

fredbert

Moderator
NAS Support
Subscriber
5,121
2,072
NAS
DS1520+, DS218+, DS215j
Router
  1. RT2600ac
  2. MR2200ac
  3. RT6600ax
  4. WRX560
Operating system
  1. macOS
Mobile operating system
  1. iOS
Background: I have a bit of Perl CGI code that I use to scan a requested web folder and return RSS code for a podcast feed. I had this within a virtual host in Web Station and was working in DSM 7.1 and earlier. But after updating to DSM 7.2 and the associated Web Station update I found that I could only run the CGI script, or any script, when requesting using the default host server name. I've raised a ticket with Synology Support but also decided to dig a bit more.

First, check what the Apache conf files looked like in DSM 7.1: I found that all virtual hosts are contained in /usr/local/etc/apache24/sites-enabled. Comparing the files and I can see they all have Options MultiViews FollowSymLinks ExecCGI in the <Directory> block. Yep that's what I expected.

Looking in DSM 7.2 and things have changed. Only the Web Station default host file has the Options directive. The virtual hosts created from Web Portals no longer have any Options. I tried adding the Options line and restarting Web Station, but that overwrote the edit. Doing the edit again and stop/start Apache, great! the Perl CGI is now working. But this is quite temporary.

I then looked to see where the template file is that Web Station uses to generate these virtual hosts files and found a likely canditate here /volume1/@appstore/WebStation/misc/apache24_service_template.mustache. There are two <VirtualHosts> blocks and I placed the Options directive inside both of their <Directory> blocks. There is another file that has the Options directive, VirtualHost-apache24.mustache. There must be some hierarchy of files and what feeds into what. But I can't yet say how this wasn't an issue before and now is one.

I've stop/started Web Station and Apache and the regenerated files have the Options directives, and my Perl CGI is working. Definitely needs some more investigating but for now I can wait a while for Support to respond to what I've found out.
 
Last edited:
Have just heard from Synology Support and the reply is that HQ have advised the fix is to do the edit to /volume1/@appstore/WebStation/misc/apache24_service_template.mustache (or whichever volumeN you've installed Web Station). Still waiting to heard if this will be the final fix or only temporary.

[update: the path, avoiding knowing which volume it's installed on, is /var/packages/WebStation/target/misc ]
 
Last edited:
Web Station 4.2.0-0485

For now, it is confirmed that to enable dynamic CGI scripts in Web Station's Web Services (virtual hosts) using Apache 2.4 as the engine you must edit the package's configuration file /var/packages/WebStation/target/misc/apache24_service_template.mustache. When updating Web Station this edit will have to be reapplied. To ensure that the affected Web Services get the edit applied to their generated site.conf file I recommend accessing each in Web Station and re-save them.

Yes, the fix is to do what you have done, the developers have recorded this issue I believe this would be permanently fixed in a future update, but I would also recommend keeping it noted for when packages are updated.

The original apache24_service_template.mustache looks like this, and you're looking for both <VirtualHost> blocks and in them the <Directory> block.
Code:
{{#alias}}
...
<VirtualHost{{#http_port}} *:{{.}}{{/http_port}}{{#https_port}} *:{{.}}{{/https_port}}>{{#fqdn}}
...
    <Directory "{{root}}">
        AllowOverride All
...
    </Directory>
...
</VirtualHost>

{{#mdns}}
<VirtualHost{{#http_port}} *:{{.}}{{/http_port}}{{#https_port}} *:{{.}}{{/https_port}}>{{#fqdn}}
...
    <Directory "{{root}}">
        AllowOverride All
...
    </Directory>
...
</VirtualHost>
{{/mdns}}

{{/alias}}

The fix is to add the OPTIONS directive line to both blocks, as shown below.
Code:
{{#alias}}
...
<VirtualHost{{#http_port}} *:{{.}}{{/http_port}}{{#https_port}} *:{{.}}{{/https_port}}>{{#fqdn}}
...
    <Directory "{{root}}">
        Options MultiViews FollowSymLinks ExecCGI
        AllowOverride All
...
    </Directory>
...
</VirtualHost>

{{#mdns}}
<VirtualHost{{#http_port}} *:{{.}}{{/http_port}}{{#https_port}} *:{{.}}{{/https_port}}>{{#fqdn}}
...
    <Directory "{{root}}">
        Options MultiViews FollowSymLinks ExecCGI
        AllowOverride All
...
    </Directory>
...
</VirtualHost>
{{/mdns}}

{{/alias}}

Comparing the original file to the edited.
Bash:
$ diff apache24_service_template.mustache.orig apache24_service_template.mustache
66a67
>         Options MultiViews FollowSymLinks ExecCGI
118a120
>         Options MultiViews FollowSymLinks ExecCGI
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

Hi Shanti, I found the same issue, I tried to install my wordpress on Apache2.4 or Nginx, but I have the...
Replies
2
Views
6,501
  • Question
I am new to Synology Web Station. I have a static IP address. I have 4 domains. I have the router port...
Replies
0
Views
471
It's a bit hit and miss, what I did was to review the site configuration files that were created in...
Replies
3
Views
799
D
So I take it you are manually connecting to port 5000/5001 in your browser right? Ever since I installed...
Replies
5
Views
12,295
Thank you very much for your response, but I uninstalled WebStation/Apache 2.4 then reinstalled and...
Replies
2
Views
440
Thank You, That is what I needed, the location of the access files. I could not find any other way to do...
Replies
2
Views
956
Hello, I have a package based web service for a locally hosted Joomla site on Web Station. It was...
Replies
0
Views
1,273

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top