环境搭建

01: Ubuntu安装数据库
mysql:
看到有mysql 的socket处于 listen 状态则表示安装成功


image.png
sudo apt-get install mysql-server  #安装mysql
sudo netstat -tap | grep mysql  #查看是否启动
mongodb:
版本查询成功即安装成功
sudo apt-get install mongodb  #安装mongodb
mongo -version  #查版本

pgrep mongo -l  #查看是否启动
netstat -lanp | grep "27017"  #通过端口号查询
service mongodb start
service mongodb stop

02: 安装nginx和nodejs

mkdir git  #新建文件夹
yum -y install gcc gcc-c++ wget net-tools pcre-devel zlib-devel openssl-devel  #安装依赖
wget https://nginx.org/download/nginx-1.17.1.tar.gz  #下载nginx包
tar zxf nginx-1.17.1.tar.gz  #解压包
cd nginx-1.17.1 #进入解压文件夹

./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf  --error-log-path=/usr/local/nginx/logs/error.log --pid-path=/usr/local/nginx/logs/nginx.pid  --http-log-path=/usr/local/nginx/logs/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module         #编辑且打开https模式(/home/lighthouse/erect/nginx  自己位置)
make && make install  #安装nginx
/usr/local/nginx/sbin/nginx  #启动nginx

ps aux | grep "nginx: worker process" | awk'{print $1}'   #查看nginx配置的启动用户(可解决访问权限问题)
vi conf/nginx.conf  #修改配置文件

nginx设置开启启动:
参考官网

vim /etc/init.d/nginx  #新建文件,文件内容修改如下:
-----------------------------------------------------------------------------------------------------------------------
nginx=”/usr/local/nginx/sbin/nginx” 
NGINX_CONF_FILE=”/usr/local/nginx/conf/nginx.conf” 
pidfile: logs/nginx.pid  #需与nginx.conf一致
------------------------------------------------------------------------------------------------------------------------
chmod a+x /etc/init.d/nginx  #更改文件执行权限
chkconfig --add /etc/init.d/nginx  #加入chkconfig管理
chkconfig nginx on  #设置开机启动

常用命令:
service nginx start
service nginx stop
service nginx restart
systemctl status nginx.service  #错误提示

sudo  /home/lighthouse/erect/nginx/sbin/nginx -c /home/lighthouse/erect/nginx/conf/nginx.conf

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf  #使用nginx -c的参数指定nginx.conf文件的位置

安装nodejs

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash  #安装nvm
source ~/.bash_profile  #刷新配置

nvm install node  #安装node

安装vue框架前端

npm install -g @vue/cli  #vue脚手架

安装express框架后端

npm install express --save -g  #安装
npm  install express-generator --save -g  #安装express生成器


备注:

https://www.cnblogs.com/wangcongxing/p/12520170.html #nginx的
https://www.cnblogs.com/tanrong/p/9872733.html #数据库的

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容