我的云服务器初始化配置

由于我的服务器没有公网IP,需要云服务器+frp将我的内网服务映射到公网上,且云服务器价格比较贵,需要经常更换(薅羊毛),频繁地配置服务器环境是一件繁琐的事情。

特此记录下将一台新的云服务器配置成满足我的要求所需要的步骤,这样可以节省很多的时间。

持续更新…🏃

云服务器端

frps配置:

[common]
bind_port = 7000
token = ******

dashboard_port = 7500
vhost_http_port = 8080
# 后台账号
dashboard_user = ****** 
dashboard_pwd = ******
enable_prometheus = true

log_file = /var/log/frps.log
log_level = info
log_max_days = 1000

nginx配置:

路径 /etc/nginx/conf.d/default.conf

server {
    listen 80;
    server_name blog.zzqwtc.top;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_hide_header X-Powered-By;
    }
}

server {
    listen 80;
    server_name images.zzqwtc.top;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_hide_header X-Powered-By;
    }
}

server {
    listen 80;
    server_name cloud.zzqwtc.top;
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:8080;
    } 
}

server {
    listen 80;
    server_name zzqwtc.top;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_hide_header X-Powered-By;
    }
}

我的服务器端

frpc配置:

[common]
server_addr = xxx.xxx.xxx.xxx
server_port = 7000
token = ******
tls_enable = true

[secret_ssh_my_server]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

[pigbed]
type = http
local_port = 8000
custom_domains = images.zzqwtc.top

[blog]
type = http
local_port = 4000
custom_domains = blog.zzqwtc.top

[cloudreve]
type = http
local_port = 5212
custom_domains = cloud.zzqwtc.top

nginx配置:

路径/etc/nginx/sites-available/default

server {
        listen 8000 default_server;
        listen [::]:8000 default_server;
    
        root  /home/zzqwtc/Download/lsky-pro-2.0.4/public;
        index index.html index.htm index.nginx-debian.html index.php;

        server_name images.zzqwtc.top;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

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

}

路径/etc/nginx/conf.d/default.conf

# 公网 ipv6
server {
    listen [::]:80;
    server_name zzqwtc.top;

    location / {
        index index.html;
        root /home/zzqwtc/Download/myindex;
    }
}

server {
    listen [::]:80;
    server_name blog.zzqwtc.top;

    location / {
        index index.html;
        root /home/zzqwtc/Download/blog/public;
    }

    location /admin/ {
        proxy_pass http://127.0.0.1:4001;
    }
}
server {
    listen [::]:80;
    server_name images.zzqwtc.top;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:8000;
    }
}
server {
    listen [::]:80;
    server_name cloud.zzqwtc.top;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:5212;
    }
}

# 内网穿透 ipv6
server {
    listen 4000;
    server_name blog.zzqwtc.top;

    location / {
        index index.html;
        root /home/zzqwtc/Download/blog/public;
    }

    location /admin/ {
        proxy_pass http://127.0.0.1:4001;
    }
}

server {
    listen 5213;
    server_name zzqwtc.top;

    location / {
        index index.html;
        root /home/zzqwtc/Download/myindex;
    }
}
lsky pro图床

由于 lsky pro2.0 图床基于php-fpm8.1,要求nginx 和 fpm 为同一个用户,我的ngxin配置的是root用户,但是fpm不允许使用 root用户,所以使用命令 php-fpm8.1 -R强制使用root用户运行

DDNS-go 动态域名解析

systemctl start ddns

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zzqwtc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值