ramlife

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

建议系统选用 ubuntu

1. 准备一个 wheel 用户组的普通用户

debian 因为 php 版本问题,无法继续安装了。

2. 安装和配置 ufw

sudo apt install ufw
sudo ufw status verbose
sudo ufw app list   
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

参考: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04

3. 安装和配置 nginx, 作为我们的 web 服务器,展示网页

sudo ufw allow 'Nginx HTTP'
sudo ufw status

在浏览器中输入服务器地址,如果能看到 nginx 的欢迎页面,说明就对了。

4. 安装和配置 mysql,保存和管理我们网站的数据

sudo apt-get install mysql-server

5. 添加更新源

apt -y install software-properties-common apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://mirror.xtom.com.hk/sury/php/apt.gpg
sh -c 'echo "deb https://mirror.xtom.com.hk/sury/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'  

sudo apt-get install debian-keyring debian-archive-keyring

sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com E9C74FEEA2098A6E 

参考: https://www.zhujiceping.com/16413.html

参考: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04

centos

6.

sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo apt-get install nginx
systemctl status nginx
sudo systemctl start nginx

参考: https://www.cnblogs.com/moxiaoan/p/5683743.html
https://blog.csdn.net/QMW19910301/article/details/86628310
https://bbs.huaweicloud.com/blogs/136774

ubuntu server

7. ufw ssh 配置

sudo ufw app list
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

8. 安装 nginx

sudo apt-get update
sudo apt-get install nginx
sudo ufw allow 'Nginx HTTP'
sudo ufw status

9. 安装 mqsql

sudo apt-get install mysql-server

10. 安装 php

sudo apt-get install php-fpm php-mysql

sudo nano /etc/php/7.0/fpm/php.ini
cgi.fix_pathinfo=0

sudo systemctl restart php7.0-fpm
sudo nano /etc/nginx/sites-available/default

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name server_domain_or_IP;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

这个 root 就是以后 web 文件夹的位置。

sudo nginx -t
sudo systemctl reload nginx
sudo nano /var/www/html/info.php

<?php
phpinfo();

http://server_domain_or_IP/info.php 打开网页,应该能看到 php 的相关信息。

sudo rm /var/www/html/info.php

参考: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04

11. 登录 mqsql 并创建新用户

mysql -uroot -pxxxxxx
create user 'typechouser'@'localhost' identified by 'yyyyyy';
create database typecho;
GRANT ALL ON typecho.* TO 'typechouser'@'localhost';

11. 在 浏览器中输入 ip 地址,和 /install.php 进入 typecho 的安装界面。修改下面几行:

数据库用户名 typechouser
密码 yyyyyy

网站用户名 admin
网站密码 zzzzzz

12.

posted on 2021-03-08 18:29  ramlife  阅读(454)  评论(0编辑  收藏  举报