# DEDECMS 移動和PC站同步方案
### 后臺
1. PC和移動站共用一套數據庫,兩套CMS系統,操作方法:
> 首先默認安裝PC端CMS系統到服務器,然后再復制PC端完整CMS到移動端網站目錄
2. 選擇PC或者M端進入后臺,創建如下全局變量:
> 
3. 在`static.example.com`目錄下按照之前章節的介紹創建對應的目錄
4. 在服務器nginx上配置好訪問規則:
~~~
# 禁止使用常規URL訪問附件
location ^~ /uploads/img {
return 404;
}
location ^~ /uploads/thumb {
return 404;
}
~~~
5. 同時創建一個附件主機
~~~
server {
listen 443 ssl http2;
server_name uploads.example.com;
access_log off;
index index.html index.htm index.php;
# 這里是實際的附件物理路徑
root /alidata1/web/www.example.com/uploads;
...
}
~~~
6. 創建前臺前端資源主機
~~~
# 前端CSS
server {
listen 443 ssl http2;
server_name css.example.com;
access_log off;
index index.html index.htm index.php;
root /alidata1/web/static.example.com/css;
...
}
# 前端JS
server {
listen 443 ssl http2;
server_name js.example.com;
access_log off;
index index.html index.htm index.php;
root /alidata1/web/static.example.com/js;
...
}
# 前端圖片
server {
listen 443 ssl http2;
server_name img.example.com;
access_log off;
index index.html index.htm index.php;
root /alidata1/web/static.example.com/img;
...
}
~~~