diff --git a/rootfs/root/docker/setup/03-files.sh b/rootfs/root/docker/setup/03-files.sh index 95543f7..e14d535 100755 --- a/rootfs/root/docker/setup/03-files.sh +++ b/rootfs/root/docker/setup/03-files.sh @@ -28,7 +28,13 @@ exitCode=0 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Main script [ -d "/tmp/etc" ] && copy "/tmp/etc/." "/etc/" +[ -d "/etc/nginx/conf.d" ] || mkdir -p "/etc/nginx/conf.d" [ -f "/etc/mysql/my.cnf" ] && symlink "/etc/mysql/my.cnf" "/etc/my.cnf" +cat </etc/nginx/conf.d/phpmyadmin.conf +location ^~ /phpmyadmin { + alias "REPLACE_PHPMYADMIN_WWW_ROOT; +} +EOF # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set the exit code exitCode=$? diff --git a/rootfs/tmp/etc/nginx/nginx.conf b/rootfs/tmp/etc/nginx/nginx.conf deleted file mode 100644 index bcb2c95..0000000 --- a/rootfs/tmp/etc/nginx/nginx.conf +++ /dev/null @@ -1,82 +0,0 @@ -# nginx configuration for sites - -user REPLACE_WWW_USER; -worker_processes auto; -daemon on; -error_log REPLACE_LOG_DIR/nginx.log warn; -pid REPLACE_RUN_DIR/nginx.pid; -events { worker_connections 1024; } - -http { - include REPLACE_ETC_DIR/mime.types; - default_type "text/html"; - sendfile on; - keepalive_timeout 65; - gzip on; - map $http_upgrade $connection_upgrade { default upgrade; '' close; } - disable_symlinks off; - - server { - listen 0.0.0.0:80 default_server; - server_name REPLACE_SERVER_NAME; - client_max_body_size 0; - proxy_intercept_errors off; - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-XSS-Protection "1; mode=block" always; - add_header X-Content-Type-Options "nosniff" always; - add_header Referrer-Policy "no-referrer-when-downgrade" always; - add_header Content-Security-Policy "script-src 'self' 'unsafe-inline' 'unsafe-eval' *; frame-src 'self' *; object-src 'self'" always; - index index.php index.cgi index.pl index.aspx index.txt index.json index.html index.unknown.php index.default.php; - root /var/lib/nginx/html; - - location /health { - default_type text/plain; - return 200 'ok'; - } - location /health/text { - default_type text/plain; - return 200 'ok'; - } - location /health/json { - default_type application/json; - return 200 '{"status":"ok","message":"running"}'; - } - - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - if (!-f $document_root$fastcgi_script_name) { - return 404; - } - fastcgi_param HTTP_PROXY ""; - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param REQUEST_URI $request_uri; - fastcgi_param DOCUMENT_URI $document_uri; - fastcgi_param DOCUMENT_ROOT $document_root; - fastcgi_param SERVER_PROTOCOL $server_protocol; - fastcgi_param REQUEST_SCHEME $scheme; - fastcgi_param HTTPS $https if_not_empty; - fastcgi_param GATEWAY_INTERFACE CGI/1.1; - fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; - fastcgi_param REMOTE_ADDR $remote_addr; - fastcgi_param REMOTE_PORT $remote_port; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - fastcgi_param REDIRECT_STATUS 200; - } - - location / { - root REPLACE_PHPMYADMIN_WWW_ROOT; - } - - location /phpmyadmin { - alias /usr/share/phpmyadmin; - } -} diff --git a/rootfs/usr/local/etc/docker/init.d/00-mysqld.sh b/rootfs/usr/local/etc/docker/init.d/00-mysqld.sh index 219b1b1..715b5ba 100755 --- a/rootfs/usr/local/etc/docker/init.d/00-mysqld.sh +++ b/rootfs/usr/local/etc/docker/init.d/00-mysqld.sh @@ -107,7 +107,7 @@ SERVICE_GROUP="mysql" # Set the service group #SERVICE_GID="0" # set the group id # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # execute command variables - keep single quotes variables will be expanded later -EXEC_CMD_BIN='mysqld' # command to execute +EXEC_CMD_BIN='mariadbd' # command to execute EXEC_CMD_ARGS='--user=$SERVICE_USER --datadir=$DATABASE_DIR' # command arguments EXEC_PRE_SCRIPT='' # execute script before # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -266,6 +266,7 @@ __post_execute() { local sysname="${SERVER_NAME:-${FULL_DOMAIN_NAME:-$HOSTNAME}}" # set hostname local root_user_pass="${root_user_pass:-$DATABASE_ROOT_PASSWORD:-$}" local DATABASE_ROOT_PASSWORD="${root_user_pass:-$(__random_password)}" + db_root_user="${MYSQL_ROOT_USER_NAME:-root}" echo "$DATABASE_ROOT_PASSWORD" >"${ROOT_FILE_PREFIX}/${SERVICE_NAME}_pass" # wait sleep $waitTime @@ -278,25 +279,29 @@ __post_execute() { bash -c "$CONF_DIR/mysql/init.sh" fi if [ -n "$DATABASE_CREATE" ]; then - mysql -v -u $SERVICE_USER <