PearProject 在 WSL 下的开发环境部署教程

简介

项目管理系统:PearProject

部署环境

  • WSL(Ubuntu18.04)
  • Nginx1.16.0
  • PHP7.2
  • MySQL5.7.26
  • Redis5.0.3

项目依赖

  • PDO PHP Extension
  • PHP Igbinary
  • PHP Redis

部署过程

后端

$ cd /www/wwwroot
$ sudo git clone https://github.com/a54552239/pearProjectApi.git
$ cd pearProjectApi
$ sudo composer install
$ sudo chown www:www -R ../pearProjectApi
$ mkdir runtime
$ sudo chmod 777 -R ../pearProjectApi

前端

$ sudo chown -R $USER:$(id -gn $USER) /home/cnguu/.config
$ cd /www/wwwroot
$ sudo git clone https://github.com/a54552239/pearProject.git
$ cd pearProject
$ sudo npm install
$ sudo chown www:www -R ../pearProject

修改 vue.config.js

const DEV_URL = 'http://p1.test';
module.exports = {
    devServer: {
        disableHostCheck: true,
    }
}

Nginx 配置

先配置 Windows 下的 hosts

PearProject 在 WSL 下的部署教程

同理配置 WSL 下的 hosts

// $ sudo vim /etc/hosts
127.0.0.1 p1.test
127.0.0.1 p2.test

再配置 Nginx

server
{
    listen 80;
    server_name p1.test;
    index index.php;
    root /www/wwwroot/pearProjectApi;

    include enable-php-72.conf;

    location / {
        try_files $uri $uri/ /index.php$uri;
        if ( -f $request_filename) {
            break;
        }
        if ( !-e $request_filename) {
            rewrite ^(.*)$ /index.php/$1 last;
            break;
        }
    }

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log /dev/null; 
    }
    access_log  /dev/null;
    error_log  /www/wwwlogs/p1.test.error.log;
}

server
{
    listen 80;
    server_name p2.test;

    location /
    {
        proxy_pass http://127.0.0.1:8045;
    }
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!