创建www用户和用户组和 /data/www, /data/log目录
useradd www -m chown -R www:www /data ssh-keygen -t rsa -C "your_email@example.com"
- 初始化系统
export LC_ALL="en_US.UTF-8"
echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale
locale-gen en_US.UTF-8
locale-gen zh_CN.UTF-8
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt-get update
apt-get install -y software-properties-common
- 初始化软件源
add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:nginx/stable
grep -rl ppa.launchpad.net /etc/apt/sources.list.d/ | xargs sed -i 's/http:\/\/ppa.launchpad.net/https:\/\/launchpad.proxy.ustclug.org/g'
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
# https://mirrors.tuna.tsinghua.edu.cn/ 2021-02-05移除 nodesource 镜像
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
echo 'deb https://deb.nodesource.com/node_10.x focal main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src https://deb.nodesource.com/node_10.x focal main' >> /etc/apt/sources.list.d/nodesource.list
apt-get update
- 安装基础软件
apt-get install -y curl git build-essential unzip supervisor
- 安装PHP8.0
apt-get install -y php8.0-bcmath php8.0-cli php8.0-curl php8.0-fpm php8.0-gd php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-pgsql php8.0-readline php8.0-xml php8.0-zip php8.0-sqlite3 php8.0-redis
- 安装nginx redis-server memcached sqlite3
apt-get remove -y apache2
apt-get install -y nginx redis-server memcached sqlite3
安装node
apt-get install -y nodejs yarn su - www yarn config set registry https://registry.npm.taobao.org'
安装composer
curl https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer chmod +x /usr/local/bin/composer su - www composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/' }
laravel站点配置
touch /etc/nginx/sites-enabled/zhoujiping_backend vim /etc/nginx/sites-enabled/zhoujiping_backend
server {
listen 80;
listen 443 ssl;
server_name api.zhoujiping.com;
root "/data/www/zhoujiping_backend/public";
ssl_certificate /data/ssl/zhoujiping_com/qiyitu.pem;
ssl_certificate_key /data/ssl/zhoujiping_com/private.key;
# 防止页面被其他站的frame嵌套
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_log /data/logs/nginx/zhoujiping_backend_error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
vue站点
server { listen 443 ssl; server_name system.zhoujiping.com; root "/data/www/zhoujiping_frontend_system"; ssl_certificate /data/ssl/qiyitu_com/1bgm.pem; ssl_certificate_key /data/ssl/qiyitu_com/private.key; charset utf-8; location / { # vue h5 history mode try_files $uri $uri/ /; index index.html index.htm; } access_log off; error_log off; } server { listen 80; server_name system.zhoujiping.com; return 301 https://system.zhoujiping.com$request_uri; }
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。