升级
sudo apt update && sudo apt upgrade
sudo 取消密码
sudo visudo
在%sudo ALL=(ALL:ALL) ALL下面添加一行
username ALL=(ALL) NOPASSWD: ALL
服务安装
sudo apt install php7.4 php7.4-curl php7.4-mysql php7.4-zip php7.4-fpm php7.4-mongodb php7.4-mbstring php7.4-xml php7.4-gd
sudo apt install nginx
sudo apt install redis-server
sudo apt install rabbitmq-server
可能还需要安装 sudo apt install php7.4-redis
xdebug 配置
windows 执行 ipconfig 查看子系统 ip
ubuntu cd /etc/php/7.4/mods-available
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=172.26.48.1 # 子系统 ip
xdebug.remote_port=9001
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
remote_connect_back=0
xdebug.remote_log=/var/log/xdebug/xdebug.log
安装项目
cd /var/www/
sudo git clone xxx
sudo chown -R wu:wu xxx
cp .env-example .env
composer install --vvv
php artisan key:generate
文件夹权限问题
sudo chmod -R 777 storage/
sudo chmod -R 777 public/
setfacl -R -m d:www-data:rwx storage/
setfacl -R -m d:wu:rwx storage/
setfacl -R -m d:www-data:rwx public/
setfacl -R -m d:wu:rwx public/
nginx 配置
cd /etc/nginx/sites-available
vi tax
复制以下内容:
server {
gzip on;
gzip_min_length 1k;
gzip_buffers 16 64k;
gzip_http_version 1.1;
gzip_comp_level 9;
gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
fastcgi_read_timeout 3600s;
listen 80;
listen [::]:80;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/tax-manage/public;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name tax-manage.test;
location / {
try_files $uri $uri/ /index.php?$query_string;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
}
关联文件并重启 nginx
cd ../sites-enabled
sudo ln -s /etc/nginx/sites-available/tax
sudo service nginx restart
git 换行符统一和记住密码
git config --global core.autocrlf input
cd ~
sudo vi .gitconfig
复制以下内容:
[user]
email = xxx@rockfintech.com
name = xxx
[credent]
helper = cache --timeout=144000
[credential]
helper = store
[core]
autocrlf = input
在 sourcetree 中添加 \wsl$/ubuntu/var/www/tax-manage,
然后编辑配置文件:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
autocrlf = input
启动服务
sudo service nginx start
sudo service php7.4-fpm start
sudo service redis-server start
sudo rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server start &
zsh 命令行工具
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
装好以后作为默认 shell,编辑配置文件:
sudo vi ~/.zshrc
ZSH_THEME="cloud"
plugins=(git laravel5 zsh-autosuggestions zsh-syntax-highlighting emoji)
然后再去安装下插件:
cd ~/.oh-my-zsh/plugins/
git clone git://github.com/zsh-users/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
更新配置
source ~/.zshrc