update
This commit is contained in:
parent
2c47462908
commit
c014f0dbb3
35
README.md
35
README.md
@ -4,11 +4,15 @@ OS: Debian / Ubuntu
|
||||
|
||||
----
|
||||
## 安裝步驟
|
||||
|
||||
- 安裝 Nginx
|
||||
|
||||
```
|
||||
sudo apt-get install nginx
|
||||
```
|
||||
|
||||
- 安裝 MariaDB (MySQL)
|
||||
|
||||
> 官方網站 https://downloads.mariadb.org/mariadb/repositories/
|
||||
|
||||
```
|
||||
@ -21,7 +25,9 @@ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.yz.yamagata-u.
|
||||
sudo apt-get update
|
||||
sudo apt-get install mariadb-server
|
||||
```
|
||||
|
||||
- 修改資料庫設定
|
||||
|
||||
> 設定資料庫文字編碼為UTF-8
|
||||
|
||||
```
|
||||
@ -45,21 +51,29 @@ character_set_server = utf8
|
||||
collation_server = utf8_general_ci
|
||||
# Import all .cnf files from configuration directory
|
||||
```
|
||||
|
||||
- 重啟資料庫完成設定
|
||||
|
||||
```
|
||||
sudo systemctl restart mysql
|
||||
```
|
||||
|
||||
- 安裝 PHP-FPM 與相關套件 (PHP 7.0)
|
||||
|
||||
```
|
||||
sudo apt-get install php7.0-cli php7.0-curl php7.0-dev php7.0-fpm php7.0-imap php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-readline php7.0-xml php7.0-xmlrpc php7.0-zip
|
||||
```
|
||||
|
||||
- 修改 php-fpm 設定
|
||||
|
||||
```
|
||||
# sudo vim /etc/php/7.0/fpm/pool.d/www.conf
|
||||
# 確認 fpm cgi 監聽位置
|
||||
listen = /run/php/php7.0-fpm.sock
|
||||
```
|
||||
|
||||
- 新增 Nginx 執行 PHP 設定
|
||||
|
||||
```
|
||||
# sudo vim /etc/nginx/php-fpm.conf
|
||||
location ~ \.php$ {
|
||||
@ -71,11 +85,15 @@ location ~ \.php$ {
|
||||
#fastcgi_pass 127.0.0.1:9000;
|
||||
}
|
||||
```
|
||||
|
||||
- 產生SSL DHParam
|
||||
|
||||
```
|
||||
sudo openssl -out /etc/nginx/dhparam.pem 2048
|
||||
```
|
||||
|
||||
- 新增Let's encrypt 設定
|
||||
|
||||
```
|
||||
# sudo vim /etc/nginx/letsencrypt.conf
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
@ -83,11 +101,15 @@ location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/letsencrypt;
|
||||
}
|
||||
```
|
||||
|
||||
- 安裝 Certbot (let's encrypt cli)
|
||||
|
||||
```
|
||||
sudo apt-get install certbot -t stretch-backports
|
||||
```
|
||||
|
||||
- 修改 Nginx 設定用來執行 Let's encrypt
|
||||
|
||||
> 找到 location / 在上面新增 include letsencrypt.conf;
|
||||
|
||||
```
|
||||
@ -100,30 +122,40 @@ location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
```
|
||||
|
||||
- 建立 let's encrypt 驗證用資料夾
|
||||
|
||||
```
|
||||
sudo mkdir -p /var/www/letsencrypt
|
||||
# 變更資料夾擁有者到 www-data
|
||||
sudo chown -R www-data:www-data /var/www
|
||||
```
|
||||
|
||||
- 重新啟動 Nginx 應用剛剛修改的設定
|
||||
|
||||
```
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
- 申請SSL憑證 (webroot)
|
||||
|
||||
> 執行前確定DNS A record 是不是有指到伺服器上
|
||||
|
||||
```
|
||||
sudo certbot certonly --webroot -w /var/www/letsencrypt -d domain.name
|
||||
```
|
||||
|
||||
- 下載Wordpress 網頁檔案
|
||||
|
||||
```
|
||||
cd /var/www
|
||||
sudo wget https://tw.wordpress.org/wordpress-5.2-zh_TW.tar.gz
|
||||
sudo tar zxvf wordpress-5.2-zh_TW.tar.gz
|
||||
sudo chown -R www-data:www-data /var/www
|
||||
```
|
||||
|
||||
- 新增wordpress nginx 設定
|
||||
|
||||
> [Config file](wordpress.conf) 下載此設定檔到伺服器,並且修改設定檔內部的 "domain.name" 為自己的domain name
|
||||
|
||||
```
|
||||
@ -136,9 +168,12 @@ sudo nginx -t
|
||||
# 確定設定無誤 重啟nginx
|
||||
sudo systemctl restart nginx
|
||||
```
|
||||
|
||||
- 建立wordpress用的資料庫
|
||||
|
||||
```
|
||||
# 建立名為 wordpress 的資料庫
|
||||
echo "create database wordpress;" | mysql -u root -p
|
||||
```
|
||||
|
||||
- 開啟瀏覽器設定安裝wordpress
|
Loading…
Reference in New Issue
Block a user