diff --git a/Dockerfile b/Dockerfile
index 60fe68d..d84fab0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -11,9 +11,18 @@ RUN mkdir -p /var/www/machete && \
./configure --without-http_rewrite_module --without-http_gzip_module && \
make && make install && \
cd ../php-8.1.6/ && \
- ./configure --enable-fpm && make && make install
-##TODO: 下载最新源码,并配置好nginx完成部署
+ ./configure --enable-fpm && make && make install && \
+ cd ../ && wget "https://git.filesite.io/filesite/machete/archive/master.tar.gz" && \
+ tar -zxvf master.tar.gz && \
+ mv machete/* /var/www/machete/ && \
+ cd /var/www/ && rm -rf downloads/ && \
+ cd /var/www/machete/ && \
+ mkdir -p /usr/local/nginx/conf/conf.d && \
+ rm -f /usr/local/nginx/conf/nginx.conf && \
+ cp conf/nginx_default.conf /usr/local/nginx/conf/nginx.conf && \
+ cp conf/nginx_machete.conf /usr/local/nginx/conf/conf.d/machete.conf
+EXPOSE 80/tcp
ENTRYPOINT ["/var/www/machete/docker-entrypoint.sh"]
## 默认使用导航站皮肤:webdirectory
CMD ["webdirectory"]
diff --git a/conf/nginx_default.conf b/conf/nginx_default.conf
new file mode 100644
index 0000000..5ba3c77
--- /dev/null
+++ b/conf/nginx_default.conf
@@ -0,0 +1,35 @@
+#user nobody;
+worker_processes 1;
+
+#error_log logs/error.log;
+#error_log logs/error.log notice;
+#error_log logs/error.log info;
+
+#pid logs/nginx.pid;
+
+
+events {
+ worker_connections 1024;
+}
+
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+
+ #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ # '$status $body_bytes_sent "$http_referer" '
+ # '"$http_user_agent" "$http_x_forwarded_for"';
+
+ #access_log logs/access.log main;
+
+ sendfile on;
+ #tcp_nopush on;
+
+ #keepalive_timeout 0;
+ keepalive_timeout 65;
+
+ #gzip on;
+
+ include /usr/local/nginx/conf/conf.d/*.conf;
+}
diff --git a/conf/nginx_machete.conf b/conf/nginx_machete.conf
new file mode 100644
index 0000000..0e91874
--- /dev/null
+++ b/conf/nginx_machete.conf
@@ -0,0 +1,48 @@
+# machete
+server {
+ listen 80;
+ server_name _;
+
+ #charset UTF-8;
+ #access_log logs/machete.access.log main;
+
+ root /var/www/machete/www;
+ index index.php index.html;
+
+ location / {
+ try_files $uri $uri/ /index.php?$args;
+ }
+
+ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
+ location ~ ^/index\.php$ {
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME /var/www/machete/www$fastcgi_script_name;
+ include fastcgi_params;
+ }
+
+ # deny all other php
+ location ~ \.php {
+ deny all;
+ }
+
+ # deny all md
+ location ~ \.md {
+ deny all;
+ }
+
+ # deny all txt
+ location ~ \.txt {
+ deny all;
+ }
+
+ # deny all url
+ location ~ \.url {
+ deny all;
+ }
+
+ # deny all hidden files
+ location ~ /\. {
+ deny all;
+ }
+}
diff --git a/conf/template_googleimage.php b/conf/template_googleimage.php
new file mode 100644
index 0000000..91d1fe1
--- /dev/null
+++ b/conf/template_googleimage.php
@@ -0,0 +1,32 @@
+ 'Asia/Shanghai', //timezone
+
+ //文档站皮肤
+ //'content_directory' => 'content/', //directory of contents in /www/
+ //when it's empty, use layout and views in directory views/
+ //'theme' => 'manual', //name of theme which is enabled
+
+ //导航站皮肤
+ //'content_directory' => 'navs/', //directory of contents in /www/
+ //'theme' => 'webdirectory',
+
+ //图片站皮肤
+ 'content_directory' => 'dogs/', //directory of contents in /www/
+ 'theme' => 'googleimage', //name of theme which is enabled
+
+ 'default_layout' => 'main', //default layout
+ 'error_layout' => 'error', //exception layout, show error title and content
+
+ //for debug, log directory: ../runtime/logs/
+ 'debug' => false,
+
+ //for themes
+ 'googleimage' => [
+ 'imageHeight' => 180, //图片高度,单位:px
+ 'contact' => 'FileSite图片网站订制联系:FileSite.io',
+ ],
+);
diff --git a/conf/template_manual.php b/conf/template_manual.php
new file mode 100644
index 0000000..248470b
--- /dev/null
+++ b/conf/template_manual.php
@@ -0,0 +1,32 @@
+ 'Asia/Shanghai', //timezone
+
+ //文档站皮肤
+ 'content_directory' => 'content/', //directory of contents in /www/
+ //when it's empty, use layout and views in directory views/
+ 'theme' => 'manual', //name of theme which is enabled
+
+ //导航站皮肤
+ //'content_directory' => 'navs/', //directory of contents in /www/
+ //'theme' => 'webdirectory',
+
+ //图片站皮肤
+ //'content_directory' => 'dogs/', //directory of contents in /www/
+ //'theme' => 'googleimage', //name of theme which is enabled
+
+ 'default_layout' => 'main', //default layout
+ 'error_layout' => 'error', //exception layout, show error title and content
+
+ //for debug, log directory: ../runtime/logs/
+ 'debug' => false,
+
+ //for themes
+ //'googleimage' => [
+ // 'imageHeight' => 180, //图片高度,单位:px
+ // 'contact' => 'FileSite图片网站订制联系:FileSite.io',
+ //],
+);
diff --git a/conf/template_webdirectory.php b/conf/template_webdirectory.php
new file mode 100644
index 0000000..ac47c22
--- /dev/null
+++ b/conf/template_webdirectory.php
@@ -0,0 +1,32 @@
+ 'Asia/Shanghai', //timezone
+
+ //文档站皮肤
+ //'content_directory' => 'content/', //directory of contents in /www/
+ //when it's empty, use layout and views in directory views/
+ //'theme' => 'manual', //name of theme which is enabled
+
+ //导航站皮肤
+ 'content_directory' => 'navs/', //directory of contents in /www/
+ 'theme' => 'webdirectory',
+
+ //图片站皮肤
+ //'content_directory' => 'dogs/', //directory of contents in /www/
+ //'theme' => 'googleimage', //name of theme which is enabled
+
+ 'default_layout' => 'main', //default layout
+ 'error_layout' => 'error', //exception layout, show error title and content
+
+ //for debug, log directory: ../runtime/logs/
+ 'debug' => false,
+
+ //for themes
+ //'googleimage' => [
+ // 'imageHeight' => 180, //图片高度,单位:px
+ // 'contact' => 'FileSite图片网站订制联系:FileSite.io',
+ //],
+);
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 03bc66b..d1f830c 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -1,20 +1,16 @@
#!/bin/sh
-themes=(
-manual
-googleimage
-webdirectory
-)
-
theme=$1
-if [ ! -z "${theme}" ]; then
- if [[ ! "${themes[@]}" =~ "${theme}" ]]; then
- theme=webdirectory
- fi
-else
+if [ ! -d "/var/www/machete/themes/${theme}/" ]; then
theme=webdirectory
fi
echo "Theme chosed [${theme}]."
-##TODO: 复制对应皮肤的配置文件到docker容器指定目录
+## 复制对应皮肤的配置文件
+cd /var/www/machete/conf/
+rm -f app.php
+cp "template_${theme}.php" app.php
+
+## 启动nginx和php-fpm
+/usr/local/nginx/sbin/nginx