{"id":2456,"date":"2024-11-23T09:11:04","date_gmt":"2024-11-23T01:11:04","guid":{"rendered":"https:\/\/sanlangcode.com\/?p=2456"},"modified":"2024-11-23T09:11:04","modified_gmt":"2024-11-23T01:11:04","slug":"springbootvue3%e5%89%8d%e5%90%8e%e7%ab%af%e5%88%86%e7%a6%bb%e9%83%a8%e7%bd%b2%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/sanlangcode.com\/index.php\/2024\/11\/23\/springbootvue3%e5%89%8d%e5%90%8e%e7%ab%af%e5%88%86%e7%a6%bb%e9%83%a8%e7%bd%b2%e4%ba%91%e6%9c%8d%e5%8a%a1%e5%99%a8\/","title":{"rendered":"SpringBoot+vue3\u524d\u540e\u7aef\u5206\u79bb\u90e8\u7f72\u4e91\u670d\u52a1\u5668"},"content":{"rendered":"\n<p>\u4e91\u670d\u52a1\u4ee5\u963f\u91cc\u4e91\u4e3a\u4f8b\uff0c\u8bf7\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u4f7f\u7528\u5408\u9002\u7684\u670d\u52a1\u5668\u914d\u7f6e\u3002\u5efa\u8bae4\u6838CPU + 4GiB\u8d77\u6b65<\/p>\n\n\n\n<p>\u79c1\u6709IP:172.27.<em>.153 \uff1b\u516c\u6709IP:139.196.<\/em>.228<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u90e8\u7f72\u65b9\u5f0f<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u540e\u7aef\u670d\u52a1\u901a\u8fc7JAR\u65b9\u5f0f\u8fd0\u884c (\u90e8\u7f72\u5230 18080 \u7aef\u53e3)<\/li><li>\u524d\u7aef\u9879\u76eebuild\u7684dist\u6587\u4ef6\u5939\uff08Nginx\u90e8\u7f72\u5230 3100 \u7aef\u53e3\uff09<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u8d44\u6e90\u51c6\u5907<\/h2>\n\n\n\n<p>\u5728\u670d\u52a1\u5668root\u4e0b\u9762\u65b0\u5efa \/srv\/www\/project \u76ee\u5f55\uff0c\u4e0a\u4f20\u51c6\u5907\u4e0b\u9762\u5185\u5bb9<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u540e\u7aef jar \u5305<\/li><li>\u524d\u7aefdist\u5305<\/li><li>\u6570\u636e\u5e93sql\u6587\u4ef6\uff08\u7ed3\u6784\u548c\u6570\u636e\uff09<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u73af\u5883\u914d\u7f6e<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">MySQL\u5b89\u88c5\u914d\u7f6e\u4e0e\u521d\u59cb\u5316<\/h4>\n\n\n\n<p>\u5b89\u88c5\u6570\u636e\u5e93\u2192\u8bbe\u7f6eroot\u5bc6\u7801\u2192\u5f00\u542f\u6570\u636e\u5e93ssh\u8fde\u63a5\uff08\u53ef\u9009\uff09\u2192\u521b\u5efa\u9879\u76ee\u6570\u636e\u5e93\uff08jeecg-boot\u7b49\uff09\u2192\u8fd0\u884csql\u6587\u4ef6\u2192\u91cd\u542f\u6570\u636e\u5e93\u2192\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo yum install mysql<br>ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';<br>mysql -u root -p<br>CREATE DATABASE `jeecg-boot` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;<br>USE jeecg-boot;<br>SOURCE \/path\/jeecg-boot.sql;<br>SHOW TABLES;<br>sudo systemctl start mysql<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Nginx\u5b89\u88c5\u4e0e\u914d\u7f6e<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install nginx<br>ps -ef|grep nginx<br>sudo systemctl reload nginx<br>sudo systemctl restart nginx<br>sudo nginx -t<br>sudo systemctl status nginx<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">nginx.conf\u914d\u7f6e\u90e8\u7f72\u524d\u7aef<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">user www-data; &nbsp;# Nginx \u8fdb\u7a0b\u7684\u8fd0\u884c\u7528\u6237<br>worker_processes auto; &nbsp;# \u81ea\u52a8\u8bbe\u7f6e\u5de5\u4f5c\u8fdb\u7a0b\u6570<br>pid \/run\/nginx.pid; &nbsp;# PID \u6587\u4ef6\u8def\u5f84<br>error_log \/var\/log\/nginx\/error.log; &nbsp;# \u9519\u8bef\u65e5\u5fd7\u8def\u5f84<br>include \/etc\/nginx\/modules-enabled\/*.conf;  # \u52a0\u8f7d\u542f\u7528\u7684 Nginx \u6a21\u5757\u914d\u7f6e<br>\u200b<br>events {<br> &nbsp;  worker_connections 768;  # \u6bcf\u4e2a\u5de5\u4f5c\u8fdb\u7a0b\u7684\u6700\u5927\u8fde\u63a5\u6570<br>}<br>\u200b<br>http {<br> &nbsp;  ## \u57fa\u672c\u8bbe\u7f6e ##<br> &nbsp;  sendfile on;  # \u5f00\u542f\u9ad8\u6548\u6587\u4ef6\u4f20\u8f93<br> &nbsp;  tcp_nopush on;  # \u4f18\u5316 TCP \u4f20\u8f93\u6027\u80fd<br> &nbsp;  types_hash_max_size 2048;  # MIME \u7c7b\u578b\u54c8\u5e0c\u6700\u5927\u503c<br> &nbsp;  include \/etc\/nginx\/mime.types;  # \u52a0\u8f7d MIME \u7c7b\u578b\u914d\u7f6e<br> &nbsp;  default_type application\/octet-stream;  # \u9ed8\u8ba4 MIME \u7c7b\u578b<br> &nbsp;  access_log \/var\/log\/nginx\/access.log;<br> &nbsp;  gzip on;  # \u542f\u7528 Gzip \u538b\u7f29<br>\u200b<br> &nbsp;  server {<br> &nbsp; &nbsp; &nbsp;  listen 3100;<br> &nbsp; &nbsp; &nbsp;  server_name 139.196.*.228;  # \u4f7f\u7528\u516c\u7f51 IP \u6216\u8005\u57df\u540d<br>\u200b<br> &nbsp; &nbsp; &nbsp;  # \u914d\u7f6e\u524d\u7aef\u9759\u6001\u8d44\u6e90\u8def\u5f84<br> &nbsp; &nbsp; &nbsp;  root \/srv\/www\/project\/dist;  # \u8bbe\u7f6e\u524d\u7aef\u6253\u5305\u540e\u7684\u8d44\u6e90\u6587\u4ef6\u5939\u8def\u5f84<br>\u200b<br> &nbsp; &nbsp; &nbsp;  # \u524d\u7aef\u8def\u7531\u914d\u7f6e\uff08\u5982\u679c\u4f7f\u7528 Vue\u3001React \u7b49 SPA\uff09<br> &nbsp; &nbsp; &nbsp;  location \/ {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  try_files $uri $uri\/ \/index.html; <br> &nbsp; &nbsp; &nbsp;  }<br>\u200b<br> &nbsp; &nbsp; &nbsp;  # \u540e\u7aef\u63a5\u53e3\u4ee3\u7406\u914d\u7f6e\uff08\u540e\u7aef\u670d\u52a1\u8fd0\u884c\u5728 18080 \u7aef\u53e3\uff09<br> &nbsp; &nbsp; &nbsp; # \u540e\u7aef\u63a5\u53e3\u4ee3\u7406<br> &nbsp;  location \/jeecgboot\/ {<br> &nbsp; &nbsp; &nbsp;  proxy_pass http:\/\/127.0.0.1:18080\/jeecg-boot\/;  # \u8f6c\u53d1\u5230\u540e\u7aef\u670d\u52a1<br> &nbsp; &nbsp; &nbsp;  proxy_redirect off;<br>\u200b<br> &nbsp; &nbsp; &nbsp;  # \u6dfb\u52a0\u8de8\u57df\u54cd\u5e94\u5934<br> &nbsp; &nbsp; &nbsp;  add_header Access-Control-Allow-Origin *;<br> &nbsp; &nbsp; &nbsp;  add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;<br> &nbsp; &nbsp; &nbsp;  add_header Access-Control-Allow-Headers *;<br> &nbsp; &nbsp; &nbsp;  add_header Access-Control-Allow-Credentials true;<br>\u200b<br> &nbsp; &nbsp; &nbsp;  # OPTIONS \u8bf7\u6c42\u5feb\u901f\u8fd4\u56de<br> &nbsp; &nbsp; &nbsp;  if ($request_method = 'OPTIONS') {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return 204;<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp; &nbsp;  # \u9519\u8bef\u9875\u9762\u914d\u7f6e<br> &nbsp; &nbsp; &nbsp;  error_page 500 502 503 504 \/50x.html;<br> &nbsp; &nbsp; &nbsp;  location = \/50x.html {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  root \/usr\/share\/nginx\/html;  # \u9ed8\u8ba4\u9519\u8bef\u9875\u9762\u8def\u5f84<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>\u200b<br> &nbsp;  # \u5176\u4ed6\u914d\u7f6e<br> &nbsp;  include \/etc\/nginx\/conf.d\/*.conf;<br> &nbsp;  include \/etc\/nginx\/sites-enabled\/*;<br>}<br>\u200b<\/pre>\n\n\n\n<p>\u8bbf\u95ee\u524d\u7aef \uff1ahttp:\/\/\u4f60\u7684\u516c\u7f51IP:3100\/\u51fa\u73b0\u4e0b\u9762\u9875\u9762\u5219\u524d\u7aef\u90e8\u7f72\u6210\u529f<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Redis\u5b89\u88c5\u4e0e\u914d\u7f6e<\/h4>\n\n\n\n<p>\u5b89\u88c5\u540e\u7aef\u53e3\u9ed8\u8ba4\u548c\u5bc6\u7801\u4e3a\u7a7a\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ps -ef | grep redis<br>sudo yum install redis -y<br>redis-server --version<br>sudo systemctl start redis<br>sudo systemctl enable redis &nbsp;# \u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u9632\u706b\u5899\u6216\u5b89\u5168\u7ec4\u7aef\u53e3\u5f00\u653e<\/h4>\n\n\n\n<p>\u5bf9IPv4\u548cIPv6\u786e\u4fdd\u81f3\u5c11\u5f00\u653e\u4ee5\u4e0b\u7aef\u53e3\uff1a<\/p>\n\n\n\n<p>80 \uff0c8080\uff0c3306 \uff0c18080\uff0c3100\uff0c3300\uff0c8092\uff0c6379<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo iptables -A INPUT -p tcp --dport 18080 -j ACCEPT<br>sudo iptables -A INPUT -p tcp --dport 3100 -j ACCEPT<br>sudo iptables-save &gt; \/etc\/sysconfig\/iptables<br>sudo netstat -tuln | grep 18080<br>sudo iptables -L -n<br>sudo systemctl restart iptables<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/sanroimg.oss-cn-shanghai.aliyuncs.com\/img\/202411220947000.png\" alt=\"image-20241122094735945\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u90e8\u7f72\u540e\u7aef<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">#Window\u542f\u52a8\u547d\u4ee4\uff1a<br>java -jar jeecg-system-start-3.*.*.jar<br>\u200b<br>#Linux\u4e0b\u540e\u53f0\u8fdb\u7a0b\u542f\u52a8\u547d\u4ee4\uff1a<br>nohup java -jar jeecg-system-start-3.*.*.jar &gt;catalina.out 2&gt;&amp;1 &amp;<br>\u200b<br>#\u68c0\u67e5catalina.out\u786e\u4fdd\u4f60\u7684\u540e\u7aef\u4ee5\u53ca\u90e8\u7f72\u6210\u529f<br>\u200b<br>\u5173\u6389\u9879\u76ee\uff1a<br>ps -ef|grep java<br>kill \u8fdb\u7a0b\u53f7 <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u767b\u9646\u8bbf\u95ee<\/h3>\n\n\n\n<p>\u524d\u7aef \uff1ahttp:\/\/\u4f60\u7684\u516c\u7f51IP:3100\/<\/p>\n\n\n\n<p>\u540e\u7aef\uff1ahttp:\/\/\u4f60\u7684\u516c\u7f51IP:18080\/<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u6e05\u9664\u5197\u4f59\u6570\u636e<\/h3>\n\n\n\n<p>\u767b\u9646\u540e\u6e05\u9664\u75c5\u4f8b\u8868\u5355\uff0c\u8ba2\u5355\uff0c\u5de5\u5355\uff0c\u6d88\u606f\uff0c\u901a\u544a\u7b49\u6d4b\u8bd5\u4fe1\u606f\u3002<\/p>\n\n\n\n<p>\u521b\u5efa\u52a0\u5bc6admin\u8d26\u6237\u540e\u81ea\u884c\u521b\u5efa\u90e8\u95e8\u7528\u6237\u6743\u9650\u7b49<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e91\u670d\u52a1\u4ee5\u963f\u91cc\u4e91\u4e3a\u4f8b\uff0c\u8bf7\u6839\u636e\u5b9e\u9645\u60c5&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,12,10,8,11,4],"tags":[],"class_list":["post-2456","post","type-post","status-publish","format-standard","hentry","category-nginx","category-redis","category-spring","category-springboot","category-springmvc","category-4"],"_links":{"self":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/2456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/comments?post=2456"}],"version-history":[{"count":0,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/2456\/revisions"}],"wp:attachment":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=2456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=2456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=2456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}