in How To's, Web Services

Ever since DSM 6.0 we’ve seen that the web server has been isolated in the “Web Station” standalone package, changing the location of the corresponding files for handling Virtual Hosts. Here’s where many of the relevant bits and pieces are now stored.

– Last updated: June 21, 2017 at 11:39 am

Initial Notes:

  • Remember that many of these locations are cleaned up when DSM updates, so try to use the GUI as much as possible.
  • Remember you might have to issue sudo -i to have root access to some folders and commands.
  • Versions, for future reader’s reference:
    • DSM 6.1.1-15101 Update 4
    • DSM Package Apache 2.4 for WebStation – you might be using a different version if reading this much later in time

Virtual Hosts

The Web Station package stores the configuration json files in this folder:

/var/packages/WebStation/etc

For the most part, you’ll find the GUI configurations inside the VirtualHost.json file found in that folder.

DSM’s nginx (UI / Webstation)

The current nginx instance runs with the config files it finds under /etc/nginx. Within that folder, you’ll have these sub-folder pointers:

sites-enabled -> /usr/local/etc/nginx/sites-enabled
conf.d -> /usr/local/etc/nginx/conf.d
app.d -> /var/tmp/nginx/app.d

The main nginx.conf file includes all the files of those folders that verify the following:

include conf.d/http.*.conf;
include app.d/server.*.conf;
include sites-enabled/*;

So that’s where you want to place your `http.custom.conf` files:

/usr/local/etc/nginx/sites-enabled -> accepts any file name

One final, and important note about this is that you might have bumped into the /etc.defaults/nginx folder as well: [I think, but would have to check] this is here is where DSM will get default files in case anything gets messed up with your configuration. I.e. if you change your configuration in such a way that DSM will “panic”, then it will probably override your settings, base and custom, with information stored here. -> if anyone has more specific information on this, please share in comments.

Apache

For Apache 2.4’s  httpd services the web server’s conf files are located in fubfolders of this location:

/usr/local/etc/apache24/

In that folder you’ll find a pointer to the DSM Package’s default conf file, where you shouldn’t tinker. Instead, you should use the local sub-folder available for sites-enabled , and, just like the case for nginx, store your custom .conf files there:

/usr/local/etc/apache24/sites-enabled -> accepts *.conf named files

E.g. by creating a httpd-vhost.conf  you can have a file that will *probably* survive DSM firmware updates. 

SMB

While were at it, if you’re looking for smb.conf, it’s located here:

/etc/samba/smb.conf
/etc.defaults/samba/smb.conf


Logs

DSM’s nginx (UI / WebStation)

Server logs for both non-WebStation requests and WebStation hosts setup to run on nginx are stored in:

/var/log/nginx/ -> error.log

You might want to customise nginx‘s logs storage location (in the following example I’m saving them my “web” shared folder) add something like this to a .conf file:

access_log /volume1/web/logs/user-access.log;
error_log /volume1/web/logs/user-error.log;

Advertisement

Apache

WebStation’s Apache server logs are stored in the main log folder:

/var/log/httpd/ -> apache24-error_log (and archived versions)

PHP

It’s easier to just configure the log location by using the WebStation GUI. Select PHP Settings > press Advanced Setting > Core > and find the error_log parameter. Enter your preferred folder location there. Here’s an example of this:

Also, don’t forget that there is Xdebug support, which can be configured in the same window (select the Extensions tab instead)

 


Restarting the Web Servers

It’s kind of a bummer that there is not a simple “restart” button in WebStation, so you either start and stop the appropriate package or even WebStation, or you have to issue CLI commands.

Using the DSM’s Graphical User Interface:

You have two options to control DSM services:

  • (recommended) Use Control PanelTask Scheduler > Create Scheduled Task > Start/Stop Service
  • Use the Package Manager to start and stop the packages

General Command Line commands for handling DSM Services:

synoservicecfg --list
synoservice --status
synoservicecfg --stop <service>
synoservicecfg --hard-stop <service>
synoservicecfg --start <service>
synoservicecfg --hard-start <service>
synoservice --restart <service>
synoservicectl --restart <service>

For example, this will restart WebStation altogether:

synoservice --restart pkgctl-WebStation

nginx

nginx -s reload

or (probably more effective):

synoservicecfg --restart nginx

Apache

This should do it (verify your current Apache package):

synoservice --restart pkgctl-Apache2.4

 

Synology Diskstation DSM Login window screenshot

 

Synology DSM Package Logs

If you’re looking for where are many of the backend engine logs for Synology Packages are being stored (logs for Start and Stop of the Packages), go through this folder:

/var/log/upstart/

There you will find the upstart for the main UI nginx server (`nginx.log`), but also for Webstation’s Apache (`pkg-WebStation-apache.log`) or all sorts of packages.

Advertisement