I'm currently setting up OpenMediaVault on my Rock64 Single Board PC which is based off Debian and is configured through the web GUI running from NGINX on port 80.
I'm currently trying to install Nextcloud using NGINX, MariaDB/MySQL and PHPMyAdmin, and originally I was hoping to use Docker to install and manage them all. Unfortunately I've had nothing but problems so I reverted to installing the software from the Linux repository.
I have successfully setup a MySQL server with a user and database ready for Nextcloud and have managed to get PHPMyAdmin working on a different port 8080.
Instead of using ports I would like to use subdomains but I can't seem to get them to work. So far I have set the root directories as the following:-
/var/www/openmediavault
/var/www/phpmyadmin
/var/www/nextcloud
I would like the following subdomains:- N.B I will setup SSL at a later date once I take this over a WAN.
- http://rock64.lan (default OpenMediaVault web GUI)
- http://phpmyadmin.rock64.lan (PHPMyAdmin GUI for MySQL)
- http://nextcloud.rock64.lan (Nextcloud web GUI)
My NGINX is configured to use
/etc/nginx/sites-available
and
/etc/nginx/sites-enabled
The following symbolic links will be used with respective names:-
ln -s /etc/nginx/sites-available/openmediavault-webgui /etc/nginx/sites-enabled/openmediavault-webgui
ln -s /etc/nginx/sites-available/phpmyadmin /etc/nginx/sites-enabled/phpmyadmin
ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/nextcloud
This is the conetents of the openmediavault-webgui file
server {
server_name openmediavault-webgui;
root /var/www/openmediavault;
index index.php;
autoindex off;
server_tokens off;
sendfile on;
large_client_header_buffers 4 32k;
client_max_body_size 25M;
error_log /var/log/nginx/openmediavault-webgui_error.log error;
access_log /var/log/nginx/openmediavault-webgui_access.log combined;
error_page 404 = /404.php;
location /404.html {
internal;
}
location /extjs6/ {
alias /usr/share/javascript/extjs6/;
expires 2d;
}
location ~ ^/(css|fonts|js|images)/ {
expires 2d;
}
location /favicon {
expires 14d;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm-openmediavault-webgui.sock;
fastcgi_index index.php;
fastcgi_read_timeout 60s;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
listen 80 default_server;
include /etc/nginx/openmediavault-webgui.d/*.conf;
}
I also have a symbolic link from PHPMyAdmin's location to www directory
ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
Many thanks
Will
UPDATE 10:18 03/06/2019
Here is the server block for /etc/nginx/sites-enabled/phpmyadmin
server {
listen 80;
root /var/www/phpmyadmin;
index index.php;
server_name phpmyadmin.rock64.lan;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7-0.fpm.sock;
fastcgi_index index.php;
}
}
UPDATE 11:25 03/06/2019
After configuring my OpenWrt router I can do a DNS lookup and http://phpmyadmin.rock64.lan
is pointing to the correct IP address. However, I'm getting 502 Bad Gateway. One forum I came across mentioned setting the ownership and permissions. I've had play around with them but no change.
Under /etc/php/7.0/fpm/pool.d/ I have:
[openmediavault-webgui]
user = openmediavault-webgui
group = openmediavault-webgui
listen = /var/run/php-fpm-openmediavault-webgui.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0600
pm = ondemand
pm.max_children = 25
pm.process_idle_timeout = 10s
chdir = /
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; openmediavault php.ini settings ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories
php_value[include_path] = ".:/usr/share/php:/var/www/openmediavault"
; Pam Authentication Support (see /etc/pam.d)
php_value[pam.servicename] = "openmediavault-webgui";
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
php_value[upload_max_filesize] = 25M
; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
php_value[post_max_size] = 25M
; Do not expose to the world that PHP is installed on the server.
; http://php.net/expose-php
php_value[expose_php] = Off
; Name of the session (used as cookie name).
; http://php.net/session.name
php_value[session.name] = X-OPENMEDIAVAULT-SESSIONID
; Default timeout for socket based streams (seconds)
; http://php.net/default-socket-timeout
php_value[default_socket_timeout] = 90
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
php_value[max_execution_time] = 90
UPDATE 09/05/2019 I have now registered the FQDN as phpmyadmin.rock64.test to eliminate any conflicts and this is registered in my OpenWrt router's DNS. I can ping the domain name and I get reply back from the statically assigned IP address (192.168.1.123) I have linked to the LAN hostname. For other testing purposes I have assigned port 8080 but neither the FQDN or accessing via http://192.168.1.123:8080 works and still results in a bad gateway 502.
server {
listen 8080;
root /var/www/phpmyadmin;
index index.php index.html index.htm;
server_name phpmyadmin.rock64.test;
server_tokens off;
location ~ \.php$ {
try_files $uri +404;
# include snippets/fastcgi-php.conf;
include /etc/nginx/fastcgi.conf;
include /etc/nginx/fastcgi_params;
# fastcgi_pass unix:/var/run/php/php7-0.fpm.sock;
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
}