第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何配置nginx文件已達(dá)到nginx代理的vue項(xiàng)目訪問(wèn)到j(luò)ar包形式的springboot工程?

如何配置nginx文件已達(dá)到nginx代理的vue項(xiàng)目訪問(wèn)到j(luò)ar包形式的springboot工程?

手掌心 2019-01-17 02:14:38
問(wèn)題描述 自己寫了個(gè)demo,想放到阿里云的服務(wù)器上跑,阿里云上的環(huán)境是用的鏡像市場(chǎng)里的centos6.9+jdk8+nginx1.12.2,但是還預(yù)裝了一個(gè)tomcat,他原先有的demo應(yīng)該是vue放到nginx中,后端用的tomcat,而我的demo用的是springboot,以jar包形式打包,放到服務(wù)器上運(yùn)行前端能訪問(wèn),后端也能訪問(wèn),但是兩個(gè)交互一直是不行,所以不知道是nginx沒(méi)配置好還是別的原因 問(wèn)題出現(xiàn)的環(huán)境背景及自己嘗試過(guò)哪些方法 1.不修改springboot的端口(8081),失敗2.停止tomcat服務(wù),修改springboot端口(8080),失敗 相關(guān)代碼 // 請(qǐng)把代碼文本粘貼到下方(請(qǐng)勿用圖片代替代碼)// 這個(gè)是nginx的默認(rèn)配置文件user www www;worker_processes auto; error_log /data/wwwlogs/error_nginx.log crit;pid /var/run/nginx.pid;worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; multi_accept on;} http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 1024m; client_body_buffer_size 10m; sendfile on; tcp_nopush on; keepalive_timeout 120; server_tokens off; 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 128k; fastcgi_intercept_errors on; #Gzip Compression gzip on; gzip_buffers 16 8k; gzip_comp_level 6; gzip_http_version 1.1; gzip_min_length 256; gzip_proxied any; gzip_vary on; gzip_types text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml text/javascript application/javascript application/x-javascript text/x-json application/json application/x-web-app-manifest+json text/css text/plain text/x-component font/opentype application/x-font-ttf application/vnd.ms-fontobject image/x-icon; gzip_disable "MSIE [1-6].(?!.*SV1)"; #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. open_file_cache max=1000 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 2; open_file_cache_errors on; default server { listen 80; server_name _; access_log /data/wwwlogs/access_nginx.log combined; root /data/wwwroot/default; index index.html index.htm index.jsp; #error_page 404 /404.html; #error_page 502 /502.html; location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ .*\.(js|css)?$ { expires 7d; access_log off; } location ~ { proxy_pass http://127.0.0.1:8080; include proxy.conf; } location ~ /\.ht { deny all; } } vhost include vhost/*.conf;} 你期待的結(jié)果是什么?實(shí)際看到的錯(cuò)誤信息又是什么? 正常的結(jié)果應(yīng)該是能交互,本地還沒(méi)嘗試nginx代理vue來(lái)訪問(wèn)后端,普通的功能比如登錄,瀏覽器報(bào)錯(cuò)是OPTIONS http://127.0.0.1:8081/login net::ERR_CONNECTION_REFUSED
查看完整描述

2 回答

?
慕姐8265434

TA貢獻(xiàn)1813條經(jīng)驗(yàn) 獲得超2個(gè)贊

你前端代碼部署在哪里了沒(méi)有說(shuō)清楚,通過(guò)瀏覽器報(bào)的錯(cuò)猜測(cè)是你前端應(yīng)用調(diào)用接口的地址是127.0.0.1。
127.0.0.1指的是你電腦本機(jī)。你后臺(tái)部署在阿里云上,那么這個(gè)地址怎么著也不可能是127.0.0.1了。
所以你出問(wèn)題的地方應(yīng)該就是你前端調(diào)用api的地址有問(wèn)題。

查看完整回答
反對(duì) 回復(fù) 2019-03-01
  • 2 回答
  • 0 關(guān)注
  • 1864 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)