6

Windows 11 React 搭建方式

 3 years ago
source link: https://azhuge233.com/windows-11-react-%e6%90%ad%e5%bb%ba%e6%96%b9%e5%bc%8f/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

windows11 是 blueedgetechno 用 React 实现的 Web Windows 11 UI

下文将展示如何在 Debian 10 搭建此项目

  • Debian 10

以下指令均在 root 用户下执行,其他用户酌情添加 sudo

安装 Node.js 环境

curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt install -y nodejs
npm install -g yarn
yarn global add serve
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
apt install -y nodejs
npm install -g yarn
yarn global add serve

安装 Windows 11 React

获取源代码

git clone https://github.com/blueedgetechno/windows11.git
cd windows11
git clone https://github.com/blueedgetechno/windows11.git
cd windows11
cd windows11
npm install
npm audit fix
cd windows11
npm install
npm audit fix

编译并运行

npm run build
serve -s build
npm run build
serve -s build

serve 默认监听0.0.0.0:5000,外网直接访问有安全问题,可以使用 -l 参数指定监听 URL,随后配置 Web 服务器反代

serve -s build -l tcp://127.0.0.1:5000
serve -s build -l tcp://127.0.0.1:5000

Nginx 反代

/etc/nginx/sites-available 下新建配置文件 win11,写入以下内容

server {
listen 80;
server_name [your domain here];
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
server {
        listen 80;
        server_name [your domain here];

        location / {
                proxy_pass http://127.0.0.1:5000;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
        }
}

软链接启用配置文件

ln -s /etc/nginx/sites-available/win11 /etc/nginx/sites-enabled/win11
ln -s /etc/nginx/sites-available/win11 /etc/nginx/sites-enabled/win11

重载 nginx

nginx -t # 测试
nginx -s reload
nginx -t # 测试
nginx -s reload

如果有域名需求,直接解析到 IP 即可

Windows 11 React 搭建方式


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK