当前位置:网站首页>Deploy LNMP environment and install Typecho blog

Deploy LNMP environment and install Typecho blog

2022-06-23 17:59:26Xiao Chen operation and maintenance

install nginx and PHP Environmental Science

[email protected]:~# apt install nginx php7.4 php7.4-mysql php7.4-fpm
 Copy code 

modify nginx The configuration file

[email protected]:~# vim /etc/nginx/sites-available/default
[email protected]:~# cat /etc/nginx/sites-available/default
server {
        listen 80;
        listen [::]:80;
        
        # Fill in the domain name or IP
        server_name www.oiox.cn; 

        # SSL configuration
        #
        
        # Turn on ssl Certificate listening port 
        listen 443 ssl; 
        listen [::]:443;
        
        # Configure certificate 
        ssl_certificate /var/www/ssl/www.oiox.cn_nginx/www.oiox.cn_bundle.pem; 
        ssl_certificate_key /var/www/ssl/www.oiox.cn_nginx/www.oiox.cn.key;
        ssl_session_timeout  5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;

        root /var/www/html;

        #  Configure the default access page 
        index index.php index.html index.htm index.nginx-debian.html;

        # Configure access path 
        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }
        
        #  Configure jump route 
        if (-f $request_filename/index.html) {
        rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php) {
        rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename) {
        rewrite (.*) /index.php;
        }

        # To configure PHP Access routing 
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
                # With php-cgi (or other tcp sockets):
                #fastcgi_pass 127.0.0.1:9000;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
                fastcgi_intercept_errors  on;
        }
}


#  Configure other domain name access 
server {
        listen 80;
        listen [::]:80;

        server_name aliyun.chenby.cn;

        root /var/www/cby;
        index index.html;

        location / {
                try_files $uri $uri/ =404;
        }
}
[email protected]:~#
 Copy code 

Start the service and set the power on auto start

[email protected]:~# nginx -t 
[email protected]:~# systemctl restart nginx 


[email protected]:~# systemctl  enable php7.4-fpm
Synchronizing state of php7.4-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable php7.4-fpm
[email protected]:~# 
[email protected]:~# 
[email protected]:~# systemctl  enable nginx
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
[email protected]:~#
 Copy code 

install docker, And use docker start-up MySQL service

[email protected]:~# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

[email protected]:~# mkdir /mysql 
[email protected]:~# cd /mysql
[email protected]:/mysql# docker run -p 3306:3306 --name mymysql --restart=always -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL\_ROOT\_PASSWORD=Cby123.. -d mysql:5.7


# Sign in MySQL Database execution create database 
create database typecho;
 Copy code 

Deploy typecho

[email protected]:~# cd /var/www/html/
[email protected]:/var/www/html# wget https://typecho.org/downloads/1.1-17.10.30-release.tar.gz
[email protected]:/var/www/html# tar xvf 1.1-17.10.30-release.tar.gz 
[email protected]:/var/www/html# mv build/* .
 Copy code 

Linux Operation and maintenance exchange community

Linux Operation and maintenance exchange community , Internet news and technology exchange .

75 Original content

official account

blog.csdn.net/qq\_3392175…

my.oschina.net/u/3981543

www.zhihu.com/people/chen…

segmentfault.com/u/hppyvyv6/…

juejin.cn/user/331578…

space.bilibili.com/352476552/a…

cloud.tencent.com/developer/c…

www.jianshu.com/u/0f894314a…

www.toutiao.com/c/user/toke…

You know 、CSDN、 Open source in China 、 Think no 、 Nuggets 、 Bili, Bili 、 Tencent cloud 、 Simple books 、 Today's headline

原网站

版权声明
本文为[Xiao Chen operation and maintenance]所创,转载请带上原文链接,感谢
https://chowdera.com/2022/01/202201031842593963.html

随机推荐