有沒有買了這個電商前端課程的小伙伴? 我學了這個課程的后端,然后打算把前端代碼直接拿來用,在部署服務器的時候出現了問題,在npm run dist之后,把dist目錄放在服務器的/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;
????????}
}然后我訪問我的網頁的時候是訪問不到css,js這些靜態資源的這里報錯顯示訪問的資源在https://mall.zjxjwxk.com/dist/?下面,這好像不太對。因為資源并沒有在根目錄下,而是在/product/mall_frontend/mmall/dist/下面。而看網頁源碼的時候,css訪問的是/dist/css/下的文件本人對前端了解不多,但想完整構建一個電商項目,前端源碼完全沒有動過,求各位大佬指點有可能在哪出了錯。
添加回答
舉報
0/150
提交
取消