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:
sudo -i to have root access to some folders and commands.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.
The current nginx instance runs with the config files it finds under /etc/nginx. Within that folder, you’ll have these sub-folder pointers:
[code]sites-enabled -> /usr/local/etc/nginx/sites-enabled
conf.d -> /usr/local/etc/nginx/conf.d
app.d -> /var/tmp/nginx/app.d[/code]
The main nginx.conf file includes all the files of those folders that verify the following:
[code]include conf.d/http.*.conf;
include app.d/server.*.conf;
include sites-enabled/*; [/code]
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.
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.
While were at it, if you’re looking for smb.conf, it’s located here:
/etc/samba/smb.conf
/etc.defaults/samba/smb.conf
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;
WebStation’s Apache server logs are stored in the main log folder:
/var/log/httpd/ -> apache24-error_log (and archived versions)
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)
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:
[code]synoservicecfg –list
synoservice –status
synoservicecfg –stop <service>
synoservicecfg –hard-stop <service>
synoservicecfg –start <service>
synoservicecfg –hard-start <service>
synoservice –restart <service>
synoservicectl –restart <service>[/code]
For example, this will restart WebStation altogether:
synoservice --restart pkgctl-WebStation
nginx -s reload
or (probably more effective):
synoservicecfg --restart nginx
This should do it (verify your current Apache package):
synoservice --restart pkgctl-Apache2.4
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.
If you have a Synology DiskStation and you have shared your public NAS link on…
Ubuntu initial setup does not do expand the virtual disk image to it's full size.…
A common issue that appeared with DSM 7 is that some well known containers started…
The Windows Sandbox image is useful for many test setups, but it lacks much of…
If you're used to Snip & Sketch for adding some scribbles placed over desktop screenshots,…
On some occasions Microsoft 365 Office applications might open a popup with "Contacting server for…
View Comments
Thank you for the article. Quick question, if I would like to make changes to the nginx configuration "location ~* .(php[345]?|phtml)$ {" any idea where I should do that? If I change "server.webstation.conf", restarting nginx resets the file to a default.
Sorry for the delay on commenting. I believe you should use the "sites-enabled" folder, which is located at
/usr/local/etc/nginx/sites-enabledand where/etc/nginx/sites-enabledpoints toDoes this mean the only place I can put files is the sites-enabled dir?
When I tried, every config is deleted and nginx.conf restored to it's original state if I put something different. Any idea wether it can be modified?
Are you using '/usr/local/etc/nginx/sites-enabled' ?
Yes, basically, the only place where my configurations doesn't get deleted after I restart nginx.
But what if I would want to define a rule which has to be put into your ex. nginx.conf file. Is this possible?