有沒(méi)有買了這個(gè)電商前端課程的小伙伴? 我學(xué)了這個(gè)課程的后端,然后打算把前端代碼直接拿來(lái)用,在部署服務(wù)器的時(shí)候出現(xiàn)了問(wèn)題,在npm run dist之后,把dist目錄放在服務(wù)器的/product/mall_frontend/mmall/下,然后配置nginx如下(zjxjwxk.com是我的域名,我用了https):mall.zjxjwk.com.confserver?{
????????listen?443?ssl;
????????autoindex?on;
????????server_name?mall.zjxjwxk.com;
????????access_log?/usr/local/nginx/logs/access.log?combined;
????????index?index.html?index.htm?index.jsp?index.php;
????????ssl_certificate?/root/.acme.sh/zjxjwxk.com/fullchain.cer;
????????ssl_certificate_key?/root/.acme.sh/zjxjwxk.com/zjxjwxk.com.key;
????????ssl_trusted_certificate?/root/.acme.sh/zjxjwxk.com/ca.cer;
????????if?(?$query_string?~*?".*[\;'\<\>].*"?){
????????????????return?404;
????????}
????????location?=?/?{
????????????????root?/product/mall_frontend/mmall/dist/view;
????????????????index?index.html;
????????}
????????location?~?.*\.html$?{
????????????????root?/product/mall_frontend/mmall/dist/view;
????????????????index?index.html;
????????}
????????location?/?{
????????????????proxy_pass?http://127.0.0.1:8080/;
????????????????add_header?Access-Control-Allow-Origin?*;
????????}
????????location?~?.*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$?{
????????????????proxy_pass?http://127.0.0.1:8080;
????????????????expires?30d;
????????}
????????location?~?.*\.(js|css)?$?{
????????????????proxy_pass?http://127.0.0.1:8080;
????????????????expires?7d;
????????}
}然后我訪問(wèn)我的網(wǎng)頁(yè)的時(shí)候是訪問(wèn)不到css,js這些靜態(tài)資源的這里報(bào)錯(cuò)顯示訪問(wèn)的資源在https://mall.zjxjwxk.com/dist/?下面,這好像不太對(duì)。因?yàn)橘Y源并沒(méi)有在根目錄下,而是在/product/mall_frontend/mmall/dist/下面。而看網(wǎng)頁(yè)源碼的時(shí)候,css訪問(wèn)的是/dist/css/下的文件本人對(duì)前端了解不多,但想完整構(gòu)建一個(gè)電商項(xiàng)目,前端源碼完全沒(méi)有動(dòng)過(guò),求各位大佬指點(diǎn)有可能在哪出了錯(cuò)。
添加回答
舉報(bào)
0/150
提交
取消