The premise

Suddenly, I want to deploy a Markdown editor on the server of Tencent Cloud for my own use. After all, I do my own work. I’ve deployed blogs and some static web pages on my server before. But I haven’t operated it in a long time. Take this opportunity to consolidate the relevant process again.

The preparatory work

One cloud server 2. One domain name 3. Finalshell for MAC and xShell for WinCopy the code

Install Ngnix

1. Download Nginx from nginx.org/download/ng…

Cx] [root @ # wget HTTP: / / http://nginx.org/download/nginx-1.6.2.tar.gzCopy the code

2. Decompress the installation package

Cx] [root @ # tar ZXVF nginx - 1.6.2. Tar. GzCopy the code

3. Go to the installation package directory

Cx] [root @ # CD nginx - 1.6.2Copy the code

4. Compile and install

Cx nginx - 1.6.2] [root @ #. / configure -- prefix = / usr/local/webserver/nginx - with - http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/ SRC /pcre-8.35 [[email protected]]# make [[email protected]]# make installCopy the code

The tutorials for installing NgniX are self-searchable online, many.

Configuration ngnix

Add md.conf to the CD /etc/ngnix/conf.d directory on the server

server { charset utf-8; client_max_body_size 128M; listen 80; server_name markdown.lieme.cn; / / website domain name root/usr/share/nginx/HTML/web/markdown /; // Static files are placed in the directory index index. HTML; location / { try_files $uri $uri/ /index.html; } // If it is a vUE package generated project, remember to configure this. // Redirect the page to idnex.html if it does not existCopy the code

After the configuration, Esc and wq save the configuration and exit.

Nginx -t to check whether the configuration is correct, then remember to restart ngnix nginx-s reload. Markdown.liem.cn should be accessible in the browser.

Enabling HTTPS Access

Since this is Tencent’s server and domain name, you can apply for a one-year free certificate directly in Tencent cloud background. Download down is a ZIP package, because the server installed is Ngnix, so we directly choose ngnix on the line.

// There is a key in the ngnix file and CRT 1_ your domain name _bundle. CRT 2_ your domain name.keyCopy the code

Upload the above two files to your ngnix directory

cd /etc/ngnix
Copy the code

Then add the following code to the newly created md.conf in the conf.d file under NgniX:

server { charset utf-8; client_max_body_size 128M; listen 80; ssl on; Ssl_certificate /etc/nginx/1_ Your domain name _bundle. CRT; Ssl_certificate_key /etc/nginx/2_ Your domain name. ssl_session_timeout 5m; }Copy the code

Configuration ssl_ciphers

Server {ssl_protocols TLSv1.1 TLSv1.2; Ssl_ciphers HIGH:! aNULL:! MD5; #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:! aNULL:! MD5:! RC4:! DHE; Ssl_ciphers' ecdhe-ecdsa-chacha20-poly1305: ssl_ciphers' ecdhe-ecdsa-chacha20-poly1305: ssl_ciphers' ecdhe-ecdsa-chacha20-poly1305: ssl_ciphers' ecdhe-ecdsa-chacha20-poly1305: ssl_ciphers' ecdhe-ecdsa-chacha20-poly1305: ssl_ciphers' ecdhe-ecdsa-chacha20-poly1305: ECDHE-RSA-CHACHA20-POLY1305: ECDHE-ECDSA-AES128-GCM-SHA256: ECDHE-RSA-AES128-GCM-SHA256: ECDHE-ECDSA-AES256-SHA384: ECDHE-RSA-AES256-SHA384: ECDHE-ECDSA-AES128-SHA256: ECDHE-RSA-AES128-SHA256'; }Copy the code

After the configuration is complete, save the configuration and exit the vi editor. Run the ngnix -t command to check whether there is any error. If yes, restart ngnix-s reload

conclusion

After the deployment is complete, it has a further deepening effect on my experience and learning. Although it has been implemented before, each experience and improvement is a different feeling:

1. Deepen the process of Linux deployment 2. Configuration related to NgniX 3. Add HTTPS to websites 4. , etc.Copy the code