ubuntu 常用的开发软件环境配置
nginx
sudo apt-get install nginx
安装成功后配置文件在/etc/nginx
systemctl status nginx 查看启动状态,启动成功
PHP
安装 PHP 7.4
sudo apt install php-fpm
安装完成后,FPM 服务将自动运行。通过以下命令检查服务状态:
systemctl status php7.4-fpm.service
配置nginx中使用PHP
-
先打开php-fpm.conf文件,找到这样一样这样的代码:listen = /run/php/php7.4-fpm.sock
-
在nginx文件中使用sock本机通信
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
# 路径使用上面文件中对应的路径
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
查看phpinfo(),调试成功。
Redis
sudo apt-get install redis-server
配置文件目录:/etc/redis
查看启动是否成功:/etc/init.d/redis-server status
# 其它命令
/etc/init.d/redis-server status | stop | restart | start
redis-cli默认一起安装了,直接使用即可连接本机redis
如需要调整配置文件:
/etc/redis/redis.conf
open命令
习惯了mac命令下的open命令,
在ubuntu下没有这个不太习惯,ubuntu下是xdg-open,ln链接一下,改为open
sudo ln -s /usr/bin/xdg-open /usr/bin/open
可以使用open了
解压软件unar
使用unzip解压的时候总是中文乱码。
安装unar解压工具
# 安装
sudo apt-get install unar
# 使用
unar file.zip
解压软件7z
# 安装
apt-get install p7zip-full
# 解压7z使用,file是你要解压的文件名。带X参数
7z x file
安装FileZilla
sudo apt-get install filezilla
直接终端命令行启动:
filezilla
Open命令替代xdg-open
习惯了mac下的open命令之后,ubuntu自带的xdg-open命令总是不习惯,制作一个软链接别名实现熟悉的open
# 链接别名open
ln -s /usr/bin/open /usr/bin/xdg-open
# 终端执行open 要找开的目录或者文件名
open path or path_file