宝塔部署项目

前端项目 VUE    前端端口 8801

VUE APP BASE API =http://localhost:8801/prod-api/'    /prod-api 指向后端 往下面看

 JAVA 后端yml    端口号8801

druid 多数据源 就是你多个库会用到这个 比如A库和B库都有user表

 下面看Nginx 配置

 

user  www www;
worker_processes auto;
error_log  /www/wwwlogs/nginx_error.log  crit;
pid        /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

events
    {
        use epoll;
        worker_connections 51200;
        multi_accept on;
    }

http
    {
        include       mime.types;
		#include luawaf.conf;

		include proxy.conf;

        default_type  application/octet-stream;

        server_names_hash_bucket_size 512;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;

        tcp_nodelay on;

        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 256k;
		fastcgi_intercept_errors on;

        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
        gzip_vary on;
        gzip_proxied   expired no-cache no-store private auth;
        gzip_disable   "MSIE [1-6]\.";

        limit_conn_zone $binary_remote_addr zone=perip:10m;
		limit_conn_zone $server_name zone=perserver:10m;

        server_tokens off;
        access_log off;

# server
#     {
#         listen 80;
#         server_name 47.104.23.18 localhost;

#         #error_page   404   /404.html;
#         include enable-php.conf;
        
#         location / {
#             root   /code/dist;
# 			      try_files $uri $uri/ /index.html;
#             index  index.html index.htm;
#         }

#         location /prod-api/{
#     			proxy_set_header Host $http_host;
#     			proxy_set_header X-Real-IP $remote_addr;
#     			proxy_set_header REMOTE-HOST $remote_addr;
#     			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#     			proxy_pass http://localhost:8080/;
# 		}

#         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
#         {
#             expires      30d;
#         }

#         location ~ .*\.(js|css)?$
#         {
#             expires      12h;
#         }

#         location ~ /\.
#         {
#             deny all;
#         }

#         access_log  /www/wwwlogs/access.log;
#     }

# access_log  /www/server/nginx/conf/log/access.log;
# error_log  /www/server/nginx/conf/log/error.log;

# 这里的意思是你子配置文件的地方
#include /www/server/panel/vhost/nginx/*.conf;
include /www/server/nginx/conf/enabled/*.conf;
}

 include /www/server/nginx/conf/enabled/*.conf; 每个端口对应的一个文件

 

 最后像下面的这种

 下面看service配置

listen 80 关于这个 你前端访问是什么就写什么端口 进行反向代理 

server {
    #前端访问的端口
    listen 80;
    server_name 47.104.23.18 localhost;

    #error_page   404   /404.html;
    include enable-php.conf;
        
    location / {
        # 这里放你的前端目录
        root   /code/dist;
		try_files $uri $uri/ /index.html;
        index  index.html index.htm;
    }

    location /prod-api/{
    	proxy_set_header Host $http_host;
    	proxy_set_header X-Real-IP $remote_addr;
    	proxy_set_header REMOTE-HOST $remote_addr;
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    	# 这里是你后端的IP 端口
    	proxy_pass http://localhost:8801/;
	}

    
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值