nginx + idea 搭配项目开发环境

nginx + idea 搭配项目开发环境

tip: ubuntu的80端口只能通过root用户才能开启,所以我采用nginx进行端口转发

  1. nginx配置
  • nginx.conf
worker_processes  2;error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;pid        logs/nginx.pid;events {    worker_connections  1024;}http {    include       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  logs/access.log  main;    sendfile        on;    #tcp_nopush     on;    #keepalive_timeout  0;    keepalive_timeout  65;    #gzip  on;    include domain/*.conf;}
  • back.conf
server {        listen       80;        server_name  localhost;        #charset koi8-r;        access_log  logs/back.access.log;         location /api {         proxy_pass http://127.0.0.1:8081/api;         proxy_set_header Host $host:80;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         client_max_body_size    200m;         #    root   html;         #   index  index.html index.htm;        }        location / {         proxy_pass http://127.0.0.1:8080;         proxy_set_header Host $host:80;         proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         client_max_body_size    200m;         #    root   html;         #   index  index.html index.htm;        }        error_page   500 502 503 504  /50x.html;        location = /50x.html {            root   html;        }}
  1. idea 配置

tips: tomcat配置只能有一个配置context 为 / ,以为tomcat的webapp下面的ROOT文件夹只存在一份,配置多份,会把之前的覆盖

  • api 项目context 配置为 /api

![

  • back 项目配置为/

大致就这些,后期继续完善...

免责声明:本网信息来自于互联网,目的在于传递更多信息,并不代表本网赞同其观点。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,并请自行核实相关内容。本站不承担此类作品侵权行为的直接责任及连带责任。如若本网有任何内容侵犯您的权益,请及时联系我们,本站将会在24小时内处理完毕。
相关文章
返回顶部