add nginx conf by subdomain
This commit is contained in:
parent
af21f1cdc2
commit
d856f6735d
5 changed files with 82 additions and 12 deletions
|
@ -36,7 +36,8 @@ RUN chown -R www:www /var/lib/nginx /var/www
|
|||
|
||||
# Copy nginx configuration
|
||||
COPY etc/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY etc/snippets_blogs.conf /etc/nginx/snippets/snippets_blogs.conf
|
||||
COPY etc/snippets_subfolder.conf /etc/nginx/snippets/snippets_subfolder.conf
|
||||
COPY etc/snippets_subdomain.conf /etc/nginx/snippets/snippets_subdomain.conf
|
||||
COPY etc/snippets_common.conf /etc/nginx/snippets/snippets_common.conf
|
||||
|
||||
##
|
||||
|
|
41
etc/snippets_subdomain.conf
Normal file
41
etc/snippets_subdomain.conf
Normal file
|
@ -0,0 +1,41 @@
|
|||
# docker-dotclear:*
|
||||
# /etc/nginx/snippets/snippets_subdomain.conf
|
||||
# Dotclear nginx default server blogs configuration by subdomains
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
index index.php index.html;
|
||||
root /var/www/dotclear/app;
|
||||
client_max_body_size 32m;
|
||||
|
||||
# Default URL and blog
|
||||
if ($dc_blog_id = '') {
|
||||
set $dc_blog_id default;
|
||||
}
|
||||
if ($dc_blog_id = 'stable') {
|
||||
set $dc_blog_id default;
|
||||
}
|
||||
|
||||
# Blogs public paths
|
||||
location ~ /public {
|
||||
root /var/www/dotclear/blogs;
|
||||
rewrite /public/(.*) /$dc_blog_id/$1 break;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Blogs themes paths (common to all blogs)
|
||||
location ~ /themes {
|
||||
root /var/www/dotclear/themes;
|
||||
rewrite /themes/(.*) /$1 break;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Dotclear regular files
|
||||
location / {
|
||||
try_files $uri $uri/ @dotclear_path_info;
|
||||
}
|
||||
|
||||
# Blogs path_info URL
|
||||
location @dotclear_path_info {
|
||||
rewrite ^/(.*) /index.php/$1 last;
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
# docker-dotclear:*
|
||||
# /etc/nginx/snippets/snippets_blogs.conf
|
||||
# Dotclear nginx default server blogs configurations
|
||||
# /etc/nginx/snippets/snippets_subfolder.conf
|
||||
# Dotclear nginx default server blogs configuration by subfolders
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
index index.php index.html;
|
||||
root /var/www/dotclear/app;
|
||||
client_max_body_size 32m;
|
||||
|
@ -15,7 +16,14 @@ location ~ /([^/]+)/public {
|
|||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Dotclear files
|
||||
# Blogs themes paths (common to all blogs)
|
||||
location ~ /([^/]+)/themes {
|
||||
root /var/www/dotclear/themes;
|
||||
rewrite /([^/]+)/themes/(.*) /$2 break;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Dotclear regular files
|
||||
location / {
|
||||
set $dc_blog_id default;
|
||||
try_files $uri $uri/ @dotclear_path_info;
|
20
www/servers/subdomain.conf
Normal file
20
www/servers/subdomain.conf
Normal file
|
@ -0,0 +1,20 @@
|
|||
# docker-dotclear:*
|
||||
# /var/www/dotclear/servers/subdomain.conf
|
||||
# Nginx server by subdomains
|
||||
|
||||
server {
|
||||
# By default, server URLs look like:
|
||||
# - http://default.domain.tld/
|
||||
# - http://blog2.domain.tld/
|
||||
# - ...
|
||||
server_name ~^(?<dc_blog_id>\w*?)?\.?(\w+\.\w+)$;
|
||||
|
||||
# To use custom configuration only use
|
||||
# include /etc/nginx/snippets/snippets_common.conf;
|
||||
# Adapt to your needs here the content of
|
||||
# /etc/nginx/snippets/snippets_subdomain.conf
|
||||
# Then disable the Dotclear plugin DockerDotclear
|
||||
# (or change their settings)
|
||||
include /etc/nginx/snippets/snippets_subdomain.conf;
|
||||
include /etc/nginx/snippets/snippets_common.conf;
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
# docker-dotclear:*
|
||||
# /var/www/dotclear/servers/default.conf
|
||||
# Default nginx server
|
||||
# /var/www/dotclear/servers/subfolder.conf
|
||||
# Nginx server by subfolders
|
||||
|
||||
server {
|
||||
server_name localhost;
|
||||
|
||||
# By default, server URLs look like:
|
||||
# - http://localhost/default
|
||||
# - http://localhost/blog2
|
||||
# - ...
|
||||
include /etc/nginx/snippets/*.conf;
|
||||
server_name localhost;
|
||||
|
||||
# To use custom domains only use
|
||||
# To use custom configuration only use
|
||||
# include /etc/nginx/snippets/snippets_common.conf;
|
||||
# Adapt to your needs here the content of
|
||||
# /etc/nginx/snippets/snippets_blogs.conf
|
||||
# /etc/nginx/snippets/snippets_subfolder.conf
|
||||
# Then disable the Dotclear plugin DockerDotclear
|
||||
# (or change its setting public_root)
|
||||
# (or change their settings)
|
||||
include /etc/nginx/snippets/snippets_subfolder.conf;
|
||||
include /etc/nginx/snippets/snippets_common.conf;
|
||||
}
|
Loading…
Reference in a new issue