当前位置:   article > 正文

Mac pro m1:黑马-苍穹外卖-部署:nginx-vue-mysql-idea_nginx 外卖 点评

nginx 外卖 点评

本文参考CSDN博主「Annnn~」的原创文章

原文链接:https://blog.csdn.net/qq_45828494/article/details/131982807

结合了黑马点评的前端部署方法。就是这篇文章:黑马Redis项目——实战篇(项目部署MAC版)_周墨瞳的博客-CSDN博客

open -e /opt/homebrew/etc/nginx/nginx.conf

原来的config是这样的:

  1. #user nobody;
  2. worker_processes 1;
  3. #error_log logs/error.log;
  4. #error_log logs/error.log notice;
  5. #error_log logs/error.log info;
  6. #pid logs/nginx.pid;
  7. events {
  8. worker_connections 1024;
  9. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  14. # '$status $body_bytes_sent "$http_referer" '
  15. # '"$http_user_agent" "$http_x_forwarded_for"';
  16. #access_log logs/access.log main;
  17. sendfile on;
  18. #tcp_nopush on;
  19. #keepalive_timeout 0;
  20. keepalive_timeout 65;
  21. #gzip on;
  22. server {
  23. listen 8080;
  24. server_name localhost;
  25. #charset koi8-r;
  26. #access_log logs/host.access.log main;
  27. location / {
  28. root html;
  29. index index.html index.htm;
  30. }
  31. #error_page 404 /404.html;
  32. # redirect server error pages to the static page /50x.html
  33. #
  34. error_page 500 502 503 504 /50x.html;
  35. location = /50x.html {
  36. root html;
  37. }
  38. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  39. #
  40. #location ~ \.php$ {
  41. # proxy_pass http://127.0.0.1;
  42. #}
  43. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  44. #
  45. #location ~ \.php$ {
  46. # root html;
  47. # fastcgi_pass 127.0.0.1:9000;
  48. # fastcgi_index index.php;
  49. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  50. # include fastcgi_params;
  51. #}
  52. # deny access to .htaccess files, if Apache's document root
  53. # concurs with nginx's one
  54. #
  55. #location ~ /\.ht {
  56. # deny all;
  57. #}
  58. }
  59. # another virtual host using mix of IP-, name-, and port-based configuration
  60. #
  61. #server {
  62. # listen 8000;
  63. # listen somename:8080;
  64. # server_name somename alias another.alias;
  65. # location / {
  66. # root html;
  67. # index index.html index.htm;
  68. # }
  69. #}
  70. # HTTPS server
  71. #
  72. #server {
  73. # listen 443 ssl;
  74. # server_name localhost;
  75. # ssl_certificate cert.pem;
  76. # ssl_certificate_key cert.key;
  77. # ssl_session_cache shared:SSL:1m;
  78. # ssl_session_timeout 5m;
  79. # ssl_ciphers HIGH:!aNULL:!MD5;
  80. # ssl_prefer_server_ciphers on;
  81. # location / {
  82. # root html;
  83. # index index.html index.htm;
  84. # }
  85. #}
  86. include servers/*;
  87. }

 改成如下代码:

  1. worker_processes 1;
  2. events {
  3. worker_connections 1024;
  4. }
  5. http {
  6. include mime.types;
  7. default_type application/octet-stream;
  8. sendfile on;
  9. keepalive_timeout 65;
  10. map $http_upgrade $connection_upgrade {
  11. default upgrade;
  12. '' close;
  13. }
  14. upstream webservers {
  15. server 127.0.0.1:8081 weight=90;
  16. #server 127.0.0.1:8088 weight=10;
  17. }
  18. server {
  19. listen 8088;
  20. server_name localhost;
  21. location / {
  22. root html/sky;
  23. index index.html index.htm;
  24. error_page 500 502 503 504 /50x.html;
  25. location = /50x.html {
  26. root html;
  27. }
  28. # Reverse proxy, handle requests sent by the management end
  29. location /api/ {
  30. proxy_pass http://webservers/admin/;
  31. }
  32. # Reverse proxy, handle requests sent by the user end
  33. location /user/ {
  34. proxy_pass http://webservers/user/;
  35. }
  36. # WebSocket
  37. location /ws/ {
  38. proxy_pass http://webservers/ws/;
  39. proxy_http_version 1.1;
  40. proxy_read_timeout 3600s;
  41. proxy_set_header Upgrade $http_upgrade;
  42. proxy_set_header Connection "$connection_upgrade";
  43. }
  44. }
  45. }
  46. }

 打开
/opt/homebrew/Cellar/nginx/1.25.1_1/

 在html中 加入:

 在idea中部署项目

如果注释爆红,则使用自己的maven

/usr/local/maven-3.3.9
/usr/local/maven-3.3.9/conf/settings.xml
/Users/huangziheng/.m2/repository

修改数据库连接yaml

修改端口号 减少冲突

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/264549
推荐阅读
相关标签
  

闽ICP备14008679号