后端spring boot项目和后台ant design pro项目部署到服务器

**

后端的部署参考

环境的安装:
https://blog.csdn.net/superficialKnowledge/article/details/88061537
springboot项目部署到云服务器上:
https://blog.csdn.net/superficialKnowledge/article/details/88181557

命令:

测试运行:java -jar wishbottle201903051205.jar --spring.profiles.active=qa
打包
nohup java -jar wishbottle201903051205.jar --spring.profiles.active=qa >wishbottle.log 2>&1 &
查看端口:sudo lsof -i:port
解除端口:sudo kill -9 pid
查看redis端口的情况:ps aux | grep redis
重启redis
先进入/root/sdk/redis目录
./src/redis-server redis.conf
查看redis密码
进入/root/sdk/redis目录,查看redif.conf文件,查询“require”,

后台的部署参考

安装Nginx 在 CentOS 7:
https://blog.51cto.com/cantgis/1540004
Ant Design Pro的project部署到nginx服务器:
https://blog.csdn.net/ws995339251/article/details/86658054

1.npm run build
2.修改vim /etc/nginx/nginx.conf

user  root;    # 这里要修改
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay    on;
    keepalive_timeout  65;

    gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

3.修改vim /etc/nginx/conf.d/default.conf

server {
    listen 80;
    # gzip config
    gzip on;
    gzip_min_length 1k;
    gzip_comp_level 9;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";

    root /usr/share/nginx/dist;

    location / {
        # 用于配合 browserHistory使用
        try_files $uri $uri/ /index.html;
        # 如果有资源,建议使用 https + http2,配合按需加载可以获得更好的体验
        # rewrite ^/(.*)$ https://preview.pro.ant.design/$1 permanent;

    }
    location /api {
        proxy_pass https://preview.pro.ant.design;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   Host              $http_host;
        proxy_set_header   X-Real-IP         $remote_addr;
    }
}

4.重启nginx:service nginx restart。浏览器访问ip:80

网页上传

https://www.cnblogs.com/hupengyin/p/6244192.html

常见命令

防火墙开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent 开放端口
systemctl restart firewalld # 重启防火墙服务使新配置生效
firewall-cmd --list-port #重新查看开放的端口

nginx
killall -9 nginx 关闭相关的端口
/usr/local/nginx/sbin/nginx 开启nginx
ps aux|grep nginx 查看nginx相关的进程

开启mongodb
mongod --dbpath E:\develop\mongodb\mongodb\db

你可能感兴趣的:(部署服务器,spring,boot,ant,design,pro,环境安装)