{"id":17642,"date":"2025-04-19T00:12:27","date_gmt":"2025-04-18T16:12:27","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/17642.html"},"modified":"2025-04-19T00:12:27","modified_gmt":"2025-04-18T16:12:27","slug":"centos%e6%90%ad%e5%bb%ba%e5%85%a8%e5%8a%9f%e8%83%bd%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%88nginxtomcatphpssl%ef%bc%89_centos-stream%e5%85%a8%e5%8a%9f%e8%83%bd%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/17642.html","title":{"rendered":"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668"},"content":{"rendered":"<p>\u672c\u6587\u5c06\u4ecb\u7ecdLinux\u73af\u5883\u4e0b\u5982\u4f55\u5b89\u88c5Web\u670d\u52a1\u57fa\u7840\u8fd0\u884c\u73af\u5883&#xff0c;\u5305\u62ec\u4ee5\u4e0b\u5185\u5bb9&#xff1a;<\/p>\n<p>\u5b89\u88c5jdk \u5b89\u88c5Tomcat \u5b89\u88c5MySQL \u5b89\u88c5PHP \u5b89\u88c5Nginx \u5b89\u88c5SSL\u8bc1\u4e66 \u6574\u5408Nginx\u548cTomcat<\/p>\n<p>\u6574\u5408\u5b8c\u6210\u540e&#xff0c;\u670d\u52a1\u5668\u5c06\u53ef\u4ee5\u6ee1\u8db3\u5927\u90e8\u5206\u5e94\u7528\u573a\u666f\u9700\u6c42\u3002<\/p>\n<p>\u4ee5\u4e0b\u6848\u4f8b\u4f7f\u7528\u7684\u670d\u52a1\u5668\u662f\u4e00\u6b3e\u7f8e\u56fd\u7684VPS&#xff0c;\u817e\u8baf\u4e91\u3001\u963f\u91cc\u4e91\u7b49\u4e91\u4e3b\u673a\u642d\u5efa\u8fc7\u7a0b\u4e0e\u4e4b\u7c7b\u4f3c\u3002<\/p>\n<p>\u9996\u5148\u770b\u4e00\u4e0b\u670d\u52a1\u5668\u7684\u53c2\u6570 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161225-680279e9d6712.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u8fd9\u53f0\u670d\u52a1\u5668\u5185\u5b58\u67091G&#xff0c;\u4f7f\u7528\u7684\u662fCentOS7 64\u4f4d\u7cfb\u7edf&#xff0c;\u53ef\u4ee5\u8dd1\u4e2d\u5c0f\u578b\u7684Java Web\u7a0b\u5e8f\u3002\u7279\u522b\u63d0\u9192&#xff0c;\u7531\u4e8e\u76ee\u524d\u7684\u9879\u76ee\u4e00\u822c\u90fd\u4f1a\u7528\u5230springmvc\u3001mybatis\u7b49\u4e00\u5806\u6846\u67b6&#xff0c;\u5bf9\u5185\u5b58\u7684\u6d88\u8017\u5f88\u5927&#xff0c;\u5efa\u8bae\u5185\u5b58\u6700\u4f4e\u914d\u7f6e\u89811G\u4ee5\u4e0a\u3002\u4ee5\u8fd9\u53f0\u670d\u52a1\u5668\u4e3a\u4f8b&#xff0c;\u53ea\u8dd1\u4e00\u4e2a\u5e94\u7528&#xff0c;\u7531\u4e8e\u7528\u4e86\u8f83\u591a\u7684\u6846\u67b6&#xff0c;tomcat\u5185\u5b58\u5360\u7528\u5df2\u8fbe\u5230277M\u3002 tomcat\u5360\u7528 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161225-680279e9eebf5.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u4e4b\u524d\u6211\u56fe\u7701\u94b1\u9009\u62e9\u4e86768M\u5185\u5b58\u7684VPS&#xff0c;\u53d1\u73b0\u6bcf\u9694\u4e00\u6bb5\u65f6\u95f4Tomcat\u5c31\u65e0\u7f18\u65e0\u6545shutdown&#xff0c;\u82b1\u4e86\u5f88\u957f\u65f6\u95f4\u6392\u67e5\u539f\u56e0&#xff0c;\u6700\u540e\u67e5\u770b\u7cfb\u7edf\u65e5\u5fd7\u624d\u53d1\u73b0\u662f\u7531\u4e8ejava\u5185\u5b58\u5360\u7528\u8fc7\u9ad8\u800c\u88ab\u7cfb\u7edf \u5f3a\u5236kill\u6389\u3002<\/p>\n<h3>\u4e8b\u524d\u51c6\u5907<\/h3>\n<p>\u7531\u4e8e\u8fd9\u53f0VPS\u9ed8\u8ba4\u7684\u8bed\u8a00\u73af\u5883\u662f\u82f1\u6587&#xff0c;\u6240\u4ee5\u9700\u8981\u5148\u5207\u6362\u5230\u4e2d\u6587\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u8bbe\u7f6e\u8bed\u8a00<\/h3>\n<p>export LANG&#061;&#034;zh\\\\_CN.UTF-8&#034;<\/p>\n<h3>&#xff08;2&#xff09;\u91cd\u65b0\u8f7d\u5165<\/h3>\n<p>. \/etc\/profile<\/p>\n<h3>&#xff08;3&#xff09;\u68c0\u67e5\u4fee\u6539\u7ed3\u679c<\/h3>\n<p>echo $LANG<\/p>\n<p>\u6b64\u5916&#xff0c;\u7531\u4e8e\u662f\u7f8e\u56fd\u7684\u670d\u52a1\u5668&#xff0c;\u6240\u4ee5\u8fd8\u8981\u5c06\u7cfb\u7edf\u7684\u65f6\u95f4\u6539\u4e3a\u5317\u4eac\u65f6\u95f4&#xff0c;\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<h3>&#xff08;1&#xff09;\u4fee\u6539\u65e5\u671f<\/h3>\n<p>date -s 16\/11\/2017<\/p>\n<h3>&#xff08;2&#xff09;\u4fee\u6539\u65f6\u95f4&#xff08;\u8fd9\u91cc\u662f\u4e0a\u534811:35&#xff09;<\/h3>\n<p>date -s 111:35<\/p>\n<h3>&#xff08;3&#xff09;\u5c06\u65f6\u949f\u5199\u5165CMOS&#xff0c;\u786e\u4fdd\u91cd\u542f\u540e\u4f9d\u7136\u751f\u6548&#xff08;\u8bb0\u5f97\u4e0d\u8981\u6f0f\u4e86\u8fd9\u4e00\u53e5&#xff09;<\/h3>\n<p>clock -w<\/p>\n<h3>&#xff08;4&#xff09;\u4fee\u6539\u65f6\u533a<\/h3>\n<p>cp -f \/usr\/share\/zoneinfo\/Asia\/Shanghai \/etc\/localtime<\/p>\n<p>\u4f1a\u63d0\u793a\u662f\u5426\u8986\u76d6&#xff0c;\u9009Y<\/p>\n<h3>\u5b89\u88c5JDK<\/h3>\n<p>\u5148\u68c0\u67e5\u4e00\u4e0b\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u88c5\u4e86jdk<\/p>\n<p>rpm -qa | grep jdk<\/p>\n<p>\u67d0\u4e9b\u7cfb\u7edf\u53ef\u80fd\u5b89\u88c5\u4e86openjdk&#xff0c;\u4e0d\u8fc7\u636e\u8bf4\u8fd9\u4e2a\u7248\u672c\u53ef\u80fd\u517c\u5bb9\u6027\u4e0d\u662f\u5f88\u597d&#xff0c;\u4f60\u53ef\u4ee5\u770b\u60c5\u51b5\u9009\u62e9\u662f\u5426\u8981\u5378\u8f7d\u800c\u91cd\u65b0\u5b89\u88c5Oracle\u7248\u672c\u3002\u6211\u8fd9\u91cc\u9009\u62e9\u7684\u662f\u5378\u8f7d\u540e\u91cd\u65b0\u5b89\u88c5\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u5378\u8f7d<\/h3>\n<p>yum remove java-1.7.0-openjdk<\/p>\n<h3>&#xff08;2&#xff09;\u5b89\u88c5Oracle\u5b98\u65b9\u7684JDK<\/h3>\n<p>\u5148\u8981\u4e0b\u8f7drpm\u5b89\u88c5\u5305&#xff0c;\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u6253\u5f00jdk\u4e0b\u8f7d\u9875\u9762&#xff0c;\u53f3\u952e\u83b7\u53d6\u94fe\u63a5\u3002\u4f46\u662f\u76ee\u524d\u7f51\u9875\u9700\u8981\u8fdb\u884c\u7528\u6237\u9a8c\u8bc1&#xff08;\u9700\u8981\u4f60\u70b9\u51fbaccept\u624d\u80fd\u4e0b\u8f7d&#xff09;&#xff0c;\u6240\u4ee5wget\u7684\u65f6\u5019\u8981\u52a0\u4e0a\u4e00\u4e9b\u53c2\u6570\u6765\u8df3\u8fc7\u8fd9\u4e2a\u68c0\u67e5\u3002<\/p>\n<p>wget &#8211;no-check-certificate &#8211;no-cookie &#8211;header &#034;Cookie:oraclelicense&#061;accept-secureback-cookie;&#034; http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u121-b13\/e9e7ea248e2c4826b92b3f075a80e441\/jdk-8u121-linux-x64.rpm<\/p>\n<h3>&#xff08;3&#xff09;\u76f4\u63a5\u5b89\u88c5<\/h3>\n<p>rpm -ivh jdk-8u121-linux-x64.rpm<\/p>\n<p>\u7cfb\u7edf\u9ed8\u8ba4\u4f1a\u5c06jdk\u5b89\u88c5\u5230\u8fd9\u4e2a\u4f4d\u7f6e&#xff1a;\/usr\/java\/jdk1.8.0_121<\/p>\n<h3>\u5b89\u88c5Tomcat<\/h3>\n<p>Tomcat\u53ef\u4ee5\u4f7f\u7528yum\u6216\u8005\u4e0b\u8f7d\u5b89\u88c5\u7684\u65b9\u5f0f&#xff0c;\u6211\u8fd9\u91cc\u91c7\u7528\u7684\u662f\u4e0b\u8f7d\u5b89\u88c5\u7684\u65b9\u5f0f\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u4e0b\u8f7d\u538b\u7f29\u5305<\/h3>\n<p>wget http:\/\/www-us.apache.org\/dist\/tomcat\/tomcat-8\/v8.5.11\/bin\/apache-tomcat-8.5.11.tar.gz<\/p>\n<h3>&#xff08;2&#xff09;\u89e3\u538b\u7f29<\/h3>\n<p>tar -zxvf apache-tomcat-8.5.11.tar.gz<\/p>\n<h3>&#xff08;3&#xff09;\u5c06apache-tomcat-8.5.11 \u79fb\u52a8\u5230\/usr\/local\u76ee\u5f55\u4e0b<\/h3>\n<p>mv apache-tomcat-8.5.11 \/usr\/local<\/p>\n<h3>&#xff08;4&#xff09;\u5c06apache-tomcat-8.5.11\u76ee\u5f55\u540d\u66f4\u540d\u4e3atomcat<\/h3>\n<p>mv \/usr\/localapache-tomcat-8.5.11\/usr\/localtomcat<\/p>\n<p>\u4e3a\u4e86\u5b89\u5168\u8d77\u89c1&#xff0c;\u6211\u4eec\u4e00\u822c\u4f1a\u5c06\u8bf8\u5982Tomcat\u3001Nginx\u7b49\u5bf9\u5916\u63d0\u4f9b\u670d\u52a1\u5e94\u7528\u7684\u76ee\u5f55\u6743\u9650\u4fee\u6539\u4e00\u4e0b\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u65b0\u5efa\u4e00\u4e2atomcat\u7528\u6237\u7ec4<\/h3>\n<p>groupadd tomcat<\/p>\n<h3>&#xff08;2&#xff09;\u65b0\u5efa\u4e00\u4e2atomcat\u7528\u6237\u5e76\u52a0\u5165tomcat\u7528\u6237\u7ec4&#xff0c;\u540c\u65f6\u9650\u5236\u8be5\u8d26\u6237\u65e0\u6cd5\u4f7f\u7528bash<\/h3>\n<p>useradd -g tomcat -s \/sbin\/nologin tomcat<\/p>\n<h3>&#xff08;3&#xff09;\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u4e00\u4e0b\u8bbe\u7f6e\u7ed3\u679c<\/h3>\n<p>id tomcat<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161226-680279ea11762.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>&#xff08;4&#xff09;\u5c06tomcat\u76ee\u5f55\u7684\u62e5\u6709\u8005\u6539\u4e3atomcat&#xff0c;\u5e76\u5c06\u76ee\u5f55\u6743\u9650\u6539\u4e3a770&#xff1a;<\/h3>\n<p>chown -R tomcat:tomcat \/usr\/local\/tomcat<\/p>\n<p>chmod -R 770 \/usr\/local\/tomcat<\/p>\n<p>\u6b64\u5916&#xff0c;\u6211\u4eec\u4e00\u822c\u8fd8\u4f1a\u8bbe\u7f6eTomcat\u968f\u7cfb\u7edf\u81ea\u52a8\u542f\u52a8\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u5728tomca\/bin \u76ee\u5f55\u4e0b\u9762&#xff0c;\u589e\u52a0 setenv.sh \u914d\u7f6e&#xff0c;catalina.sh\u4f1a\u5728tomcat\u542f\u52a8\u7684\u65f6\u5019\u88ab\u8c03\u7528\u3002<\/h3>\n<p>\u8fd9\u4e2a\u6587\u4ef6\u5305\u542b\u5982\u4e0b\u4e24\u884c\u5185\u5bb9&#xff08;Java\u5185\u5b58\u53c2\u6570\u6839\u636e\u81ea\u5df1\u670d\u52a1\u5668\u914d\u7f6e\u6765\u4fee\u6539&#xff09;&#xff1a;<\/p>\n<p>#\u6307\u5b9atomcat pid\u7684\u8def\u5f84&#xff0c;\u7cfb\u7edf\u5c06\u4ee5\u6b64\u6765\u533a\u5206\u8fdb\u7a0b CATALINA_PID&#061;\u201c$CATALINA_BASE\/tomcat.pid\u201d #\u589e\u52a0\u4e00\u4e9bjava\u5185\u5b58\u914d\u7f6e\u53c2\u6570&#xff0c;\u5e76\u4fee\u6539\u4e00\u4e0b\u65f6\u533a&#xff0c;\u5426\u5219tomcat\u65e5\u5fd7\u7684\u65f6\u95f4\u53ef\u80fd\u4e0d\u51c6\u786e JAVA_OPTS&#061;\u201c-Xms256m -Xmx512m -Xss1024K -XX:PermSize&#061;64m -XX:MaxPermSize&#061;128m -Duser.timezone&#061;Asia\/Shanghai\u201d<\/p>\n<h3>&#xff08;2&#xff09;\u6dfb\u52a0\u670d\u52a1<\/h3>\n<p>\u5207\u6362\u81f3\/usr\/lib\/systemd\/system\/\u76ee\u5f55&#xff0c;\u5efa\u7acbtomcat.service\u6587\u4ef6\u5e76\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9&#xff1a;<\/p>\n<p>[Unit]<\/p>\n<p>Description&#061;Tomcat<\/p>\n<p>After&#061;syslog.target network.target remote-fs.target nss-lookup.target<\/p>\n<p>[Service]<\/p>\n<p>Type&#061;forking<\/p>\n<p>PIDFile&#061;\/usr\/local\/tomcat\/tomcat.pid<\/p>\n<p>ExecStart&#061;\/usr\/local\/tomcat\/bin\/startup.sh<\/p>\n<p>ExecReload&#061;\/bin\/kill -s HUP $MAINPID<\/p>\n<p>ExecStop&#061;\/bin\/kill -s QUIT $MAINPID<\/p>\n<p>PrivateTmp&#061;true<\/p>\n<p>User&#061;tomcat<\/p>\n<p>Group&#061;tomcat<\/p>\n<p>[Install]<\/p>\n<p>WantedBy&#061;multi-user.target<\/p>\n<h3>&#xff08;3&#xff09;\u8bbe\u7f6e\u4e3a\u5f00\u673a\u542f\u52a8<\/h3>\n<p>systemctl enable tomcat<\/p>\n<h3>&#xff08;4&#xff09;\u542f\u52a8\u3001\u505c\u6b62\u3001\u91cd\u542ftomcat\u547d\u4ee4&#xff1a;<\/h3>\n<p>#\u542f\u52a8tomcat<\/p>\n<p>systemctl start tomcat<\/p>\n<p>#\u505c\u6b62tomcat<\/p>\n<p>systemctl stop tomcat<\/p>\n<p>#\u91cd\u542ftomcat<\/p>\n<p>systemctl restart tomcat<\/p>\n<p>#\u67e5\u770btomcat\u670d\u52a1\u72b6\u6001<\/p>\n<p>systemctl status tomcat.service<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161226-680279ea2488f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>systemctl status tomcat.service<\/p>\n<p>\u5982\u679c\u770b\u5230\u72b6\u6001\u4e3aactive(running)&#xff0c;\u8868\u660etomcat\u5df2\u7ecf\u6210\u529f\u542f\u52a8\u3002\u4e0d\u8fc7&#xff0c;\u8fd9\u65f6\u5019\u4f60\u8fd8\u4e0d\u80fd\u901a\u8fc7http:\/\/IP\u5730\u5740:8080\u6765\u8bbf\u95eetomcat&#xff0c;\u56e0\u4e3a\u6211\u4eec\u8fd8\u6ca1\u6709\u5f00\u653e8080\u7aef\u53e3\u3002\u5148\u522b\u6025&#xff0c;\u6211\u4eec\u7ee7\u7eed\u5f80\u4e0b\u8d70\u3002<\/p>\n<h3>\u5b89\u88c5PHP<\/h3>\n<h3>&#xff08;1&#xff09;\u5148\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86php\u53ca\u5176\u7248\u672c<\/h3>\n<p>yum list installed | grep php<\/p>\n<h3>&#xff08;2&#xff09;\u5982\u679c\u6709\u5b89\u88c5\u7684PHP\u5305&#xff0c;\u5148\u5220\u9664\u4ed6\u4eec<\/h3>\n<p>yum remove php.*<\/p>\n<h3>&#xff08;3&#xff09;\u914d\u7f6eyum\u6e90&#xff08;\u53ef\u80fd\u8981\u8bd5\u51e0\u6b21\u624d\u80fd\u6210\u529f&#xff09;<\/h3>\n<p>rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/epel-release.rpm<\/p>\n<p>rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/p>\n<h3>&#xff08;4&#xff09;\u63a5\u7740\u5c31\u4e00\u6b21\u6027\u5b89\u88c5php\u53ca\u76f8\u5173\u7ec4\u4ef6<\/h3>\n<p>yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 php56w-fpm.x86_64<\/p>\n<h3>&#xff08;5&#xff09;\u68c0\u67e5\u4e00\u4e0bphp\u662f\u5426\u5b89\u88c5\u6210\u529f&#xff1a;<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161226-680279ea465da.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u7531\u4e8e\u6211\u4eec\u4f7f\u7528\u7684\u662fyum\u7684\u5b89\u88c5\u65b9\u5f0f&#xff0c;\u6240\u4ee5\u5df2\u7ecf\u5e2e\u6211\u4eec\u914d\u7f6e\u597d\u76f8\u5173\u7684service\u4e86&#xff0c;\u76f4\u63a5\u542f\u52a8\u5c31\u53ef\u4ee5&#xff0c;\u76f8\u5173\u547d\u4ee4&#xff1a;<\/p>\n<p>#\u542f\u52a8<\/p>\n<p>systemctl start php-fpm<\/p>\n<p>#\u91cd\u542f<\/p>\n<p>systemctl restart php-fpm<\/p>\n<p>#\u505c\u6b62<\/p>\n<p>systemctl stop php-fpm<\/p>\n<p>#\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8php-fpm<\/p>\n<p>systemctl enable php-fpm.service<\/p>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u6211\u4eec\u8981\u5bf9php\u8fdb\u884c\u4e00\u4e0b\u914d\u7f6e\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u6253\u5f00php.ini\u914d\u7f6e\u6587\u4ef6<\/h3>\n<p>vi \/etc\/php.ini<\/p>\n<h3>&#xff08;2&#xff09;\u9650\u5236PHP\u53ea\u80fd\u64cd\u4f5c\u6307\u5b9a\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6&#xff0c;\u6ce8\u610f\u540e\u9762\u8981\u52a0\u659c\u6760\u3002<\/h3>\n<p>\u7531\u4e8e\u6211\u4eec\u4f1a\u7528\u5230Nginx\u670d\u52a1\u5668&#xff0c;\u6240\u4ee5\u8fd9\u91cc\u6211\u4eec\u5c06PHP\u76ee\u5f55\u76f4\u63a5\u653e\u5230Nginx\u9ed8\u8ba4\u7684web\u8def\u5f84\u4e4b\u4e0b&#xff08;\u89c1\u4e0b\u6587&#xff09;<\/p>\n<p>open_basedir &#061; \/usr\/local\/nginx\/html\/<\/p>\n<p>\u53e6\u5916\u8fd8\u4f1a\u6709\u5f88\u591a\u5b89\u5168\u9009\u9879\u53ef\u4ee5\u914d\u7f6e&#xff0c;\u5982allow_url_include\u3001allow_url_fopen\u3001allow_url_include\u3001display_errors\u7b49&#xff0c;\u8fd9\u4e9b\u9009\u9879\u5728\u6b63\u5f0f\u73af\u5883\u4e0b\u5efa\u8bae\u5173\u95ed\u3002\u4e0d\u8fc7\u7531\u4e8e\u672c\u6848\u4f8b\u4f1a\u7528\u5230phpMyAdmin\u8fd9\u4e2a\u53ef\u89c6\u5316\u5de5\u5177\u6765\u7ba1\u7406MySQL\u6570\u636e\u5e93&#xff0c;\u6240\u4ee5\u6682\u65f6\u5148\u4fdd\u7559\u9ed8\u8ba4\u72b6\u6001\u3002<\/p>\n<h3>\u5b89\u88c5MySQL<\/h3>\n<p>\u8fd9\u53f0\u670d\u52a1\u5668\u9ed8\u8ba4\u5b89\u88c5\u4e86MariaDB&#xff08;MySQL\u7684\u4e00\u4e2a\u5206\u652f&#xff09;&#xff0c;\u5176\u7528\u6cd5\u57fa\u672c\u8ddfMySQL\u4e00\u81f4&#xff0c;\u4f46\u4e5f\u6709\u5fae\u5c0f\u533a\u522b&#xff08;\u5982\u5b57\u6bb5\u5927\u5c0f\u5199\u95ee\u9898&#xff09;&#xff0c;\u7531\u4e8e\u6211\u5728\u672c\u5730\u5f00\u53d1\u7684\u65f6\u5019\u7528\u7684\u662fMySQL&#xff0c;\u6240\u4ee5\u8fd9\u91cc\u6211\u8fd8\u662f\u6362\u56de\u4e86MySQL\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u5378\u8f7dMariaDB<\/h3>\n<p>\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5b89\u88c5\u4e86mariadb<\/p>\n<p>rpm -qa | grep mariadb<\/p>\n<p>\u5f3a\u5236\u5378\u8f7d<\/p>\n<p>rpm -e \u2013nodeps mariadb-libs-5.5.37-1.el7_0.x86_64<\/p>\n<h3>&#xff08;2&#xff09;\u4e0b\u8f7dmysql\u7684repo\u6e90<\/h3>\n<p>wget http:\/\/repo.mysql.com\/mysql-community-release-el7-5.noarch.rpm<\/p>\n<h3>&#xff08;3&#xff09;\u5b89\u88c5mysql-community-release-el7-5.noarch.rpm\u5305<\/h3>\n<p>rpm -ivh mysql-community-release-el7-5.noarch.rpm<\/p>\n<p>\u5b89\u88c5\u8fd9\u4e2a\u5305\u540e&#xff0c;\u4f1a\u83b7\u5f97\u4e24\u4e2amysql\u7684yum repo\u6e90&#xff1a;<\/p>\n<p>\/etc\/yum.repos.d\/mysql-community.repo<\/p>\n<p>\/etc\/yum.repos.d\/mysql-community-source.repo<\/p>\n<h3>&#xff08;4&#xff09;\u4e4b\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528yum\u65b9\u5f0f\u5b89\u88c5mysql<\/h3>\n<p>yum install mysql-server<\/p>\n<h3>&#xff08;5&#xff09;\u8bbe\u4e3a\u5f00\u673a\u542f\u52a8\u5e76\u7acb\u5373\u542f\u52a8\u670d\u52a1<\/h3>\n<p>systemctl enable mysqld<\/p>\n<p>systemctl start mysqld<\/p>\n<p>\u5b89\u88c5\u5b8c\u4e4b\u540e\u8981\u7b2c\u4e00\u65f6\u95f4\u8fdb\u884c\u5b89\u5168\u521d\u59cb\u5316\u8bbe\u7f6e&#xff0c;\u76f4\u63a5\u8f93\u5165mysql_secure_installation<\/p>\n<p>mysql_secure_installation<\/p>\n<p>\u8be5\u6307\u4ee4\u4f1a\u5f15\u5bfc\u4f60\u5b8c\u6210\u521d\u59cb\u5316\u64cd\u4f5c&#xff1a;<\/p>\n<p>Set root password? [Y\/n] &lt;\u2013 \u56de\u8f66<\/p>\n<p>New password: &lt;\u2013 \u8f93\u5165ROOT\u5bc6\u7801 \/\/ KD020lzb&#064;<\/p>\n<p>Re-enter new password: &lt;\u2013 \u518d\u8f93\u5165\u4e00\u6b21ROOT\u5bc6\u7801<\/p>\n<p>Remove anonymous users? [Y\/n] &lt;\u2013 \u56de\u8f66<\/p>\n<p>Disallow root login remotely? [Y\/n] &lt;\u2013 \u56de\u8f66<\/p>\n<p>Remove test database and access to it? [Y\/n] &lt;\u2013 \u56de\u8f66<\/p>\n<p>Reload privilege tables now? [Y\/n] &lt;\u2013 \u56de\u8f66<\/p>\n<h3>&#xff08;6&#xff09;\u53ef\u4ee5\u9a8c\u8bc1\u4e00\u4e0b\u521a\u624d\u8bbe\u7f6e\u7684\u5bc6\u7801<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161226-680279ea5abda.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u6b64\u5916&#xff0c;\u7531\u4e8e\u6211\u4eec\u6570\u636e\u5e93\u4f1a\u7528\u5230\u4e2d\u6587\u5b57\u7b26\u96c6&#xff0c;\u6240\u4ee5\u8981\u8fdb\u884c\u4e00\u4e0b\u76f8\u5e94\u914d\u7f6e\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u4fee\u6539\/etc\/my.cnf<\/h3>\n<p>vi \/etc\/my.cnf<\/p>\n<p>\u5728[client]\u6bb5\u589e\u52a0&#xff1a;<\/p>\n<p>default-character-set&#061;utf8<\/p>\n<p>\u5728[mysqld]\u6bb5\u589e\u52a0&#xff1a;<\/p>\n<p>character-set-server&#061;utf8<\/p>\n<p>collation-server&#061;utf8_general_ci<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161226-680279ea74dc4.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h3>&#xff08;2&#xff09;\u914d\u7f6e\u5b8c\u6210\u540e\u8981\u91cd\u542f\u670d\u52a1<\/h3>\n<p>systemctl restart mysqld<\/p>\n<h3>\u5b89\u88c5Nginx<\/h3>\n<p>\u6211\u4f7f\u7528\u7684\u662f\u624b\u5de5\u5b89\u88c5\u7684\u65b9\u5f0f&#xff0c;\u4f60\u4e5f\u53ef\u4ee5\u9009\u62e9yum\u65b9\u5f0f<\/p>\n<h3>&#xff08;1&#xff09;Nginx\u7684\u8fd0\u884c\u9700\u8981\u4f9d\u8d56\u4ee5\u4e0b\u7ec4\u4ef6&#xff0c;\u9700\u8981\u5148\u5b89\u88c5<\/h3>\n<p>yum install -y gcc-c&#043;&#043; yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel<\/p>\n<h3>&#xff08;2&#xff09;\u4e0b\u8f7d\u5b89\u88c5\u5305<\/h3>\n<p>wget -c https:\/\/nginx.org\/download\/nginx-1.10.2.tar.gz<\/p>\n<h3>&#xff08;3&#xff09;\u89e3\u538b<\/h3>\n<p>tar -zxvf nginx-1.10.2.tar.gz<\/p>\n<h3>&#xff08;4&#xff09;\u8fdb\u5165nginx-1.10.2\u76ee\u5f55&#xff0c;\u76f4\u63a5\u7f16\u8bd1\u5b89\u88c5<\/h3>\n<p>.\/configure<\/p>\n<p>make<\/p>\n<p>make install<\/p>\n<p>\u9ed8\u8ba4\u4f1a\u5b89\u88c5\u5230\/usr\/local\/nginx\u76ee\u5f55\u3002<\/p>\n<h3>&#xff08;5&#xff09;\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8&#xff0c;\u65b9\u5f0f\u8ddftomcat\u7c7b\u4f3c<\/h3>\n<p>vi \/usr\/lib\/systemd\/system\/nginx.service<\/p>\n<p>\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9&#xff1a;<\/p>\n<p>[Unit]<\/p>\n<p>Description&#061;nginx &#8211; high performance web server<\/p>\n<p>After&#061;network.target remote-fs.target nss-lookup.target<\/p>\n<p>[Service]<\/p>\n<p>Type&#061;forking<\/p>\n<p>PIDFile&#061;\/usr\/local\/nginx\/logs\/nginx.pid<\/p>\n<p>ExecStartPre&#061;\/usr\/local\/nginx\/sbin\/nginx -t -c \/usr\/local\/nginx\/conf\/nginx.conf<\/p>\n<p>ExecStart&#061;\/usr\/local\/nginx\/sbin\/nginx -c \/usr\/local\/nginx\/conf\/nginx.conf<\/p>\n<p>ExecReload&#061;\/bin\/kill -s HUP $MAINPID<\/p>\n<p>ExecStop&#061;\/bin\/kill -s QUIT $MAINPID<\/p>\n<p>PrivateTmp&#061;true<\/p>\n<p>[Install]<\/p>\n<p>WantedBy&#061;multi-user.target<\/p>\n<p>\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u5e76\u7acb\u5373\u542f\u52a8\u670d\u52a1<\/p>\n<p>systemctl enable nginx.service<\/p>\n<p>systemctl start nginx.service<\/p>\n<h3>&#xff08;6&#xff09;\u5f00\u653e\u76f8\u5173\u7aef\u53e3<\/h3>\n<p>\u5728\u8bbf\u95ee\u5e94\u7528\u4e4b\u524d&#xff0c;\u6211\u4eec\u8981\u5148\u5728\u9632\u706b\u5899\u4e2d\u5f00\u653e\u76f8\u5173\u7684\u7aef\u53e3&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p>firewall-cmd &#8211;permanent &#8211;zone&#061;public &#8211;add-service&#061;http<\/p>\n<p>firewall-cmd &#8211;permanent &#8211;zone&#061;public &#8211;add-service&#061;https<\/p>\n<p>firewall-cmd &#8211;reload<\/p>\n<p>\u8fd9\u65f6\u5019\u8f93\u5165http:\/\/IP\u5730\u5740&#xff0c;\u5e94\u8be5\u5c31\u80fd\u591f\u770b\u5230Nginx\u4e2d\u9ed8\u8ba4\u7684\u9875\u9762\u4e86\u3002\u4e0d\u8fc7\u7531\u4e8e\u6211\u4eec\u6ca1\u6709\u5f00\u653e8080\u7aef\u53e3&#xff0c;\u6240\u4ee5\u4f60\u4e0d\u80fd\u4f7f\u75288080\u7aef\u53e3\u6765\u8bbf\u95eeTomcat\u3002\u4e3a\u4ec0\u4e48\u4e0d\u5f00\u653e8080\u7aef\u53e3\u5462&#xff1f;\u56e0\u4e3a\u6211\u4eec\u4e0d\u9700\u8981\u5f00\u653e&#xff0c;\u6211\u4eec\u8d70\u7684\u662fNginx\u53cd\u5411\u4ee3\u7406&#xff0c;Nginx\u4f1a\u81ea\u52a8\u6839\u636e\u914d\u7f6e&#xff08;\u89c1\u4e0b\u6587&#xff09;\u5c06\u5185\u5bb9\u8f6c\u4ea4\u7ed9Tomcat\u5904\u7406\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u7533\u8bf7SSL\u8bc1\u4e66\u5e76\u5bf9Nginx\u548cTomcat\u8fdb\u884c\u6574\u5408\u3002<\/p>\n<h3>\u7533\u8bf7\u514d\u8d39\u7684SSL\u8bc1\u4e66<\/h3>\n<p>\u76ee\u524dSSL\u8bc1\u4e66\u5927\u90e8\u5206\u90fd\u662f\u8981\u6536\u8d39\u7684\u3002\u5bf9\u4e8e\u4f01\u4e1a\u7f51\u7ad9&#xff0c;\u5efa\u8bae\u8fd8\u662f\u82b1\u70b9\u94b1\u4e70\u4e2a\u5b89\u5fc3\u5427&#xff0c;\u800c\u5bf9\u4e8e\u4e2a\u4eba\u7f51\u7ad9&#xff0c;\u53ef\u4ee5\u9009\u62e9\u514d\u8d39\u7684Let\u2019s encrypt\u3002<\/p>\n<p>\u5b89\u88c5SSL\u8bc1\u4e66\u7684\u8fc7\u7a0b\u5e76\u4e0d\u590d\u6742&#xff0c;\u7b2c\u4e00\u6b65\u662f\u7533\u8bf7\u8bc1\u4e66&#xff0c;\u7b2c\u4e8c\u6b65\u662f\u5728Nginx\u4e2d\u914d\u7f6e\u8bc1\u4e66\u8def\u5f84\u3002<\/p>\n<h3>&#xff08;1&#xff09;\u5b89\u88c5certbot\u5de5\u5177<\/h3>\n<p>yum install epel-release<\/p>\n<p>yum install certbot<\/p>\n<p>\u8fd9\u4e2a\u5de5\u5177\u4f1a\u5728 \u4f60\u7684\u7f51\u7ad9\u6839\u76ee\u5f55&#xff08;\u4e5f\u5c31\u662f\/usr\/local\/nginx\/html&#xff09;\/.well-known \u751f\u6210\u7279\u6b8a\u7684\u6587\u4ef6&#xff0c;\u5728\u7533\u8bf7\u8bc1\u4e66\u65f6&#xff0c;Let\u2019s Encrypt \u670d\u52a1\u4f1a\u901a\u8fc7 http \u6765\u8bbf\u95ee\u6b64\u6587\u4ef6&#xff0c;\u4ee5\u7b7e\u8bc1\u670d\u52a1\u5668&#xff0c;\u6240\u4ee5\u5728\u4f7f\u7528 certbot \u83b7\u53d6\u8bc1\u4e66\u4e4b\u524d&#xff0c;\u4f60\u8981\u786e\u4fdd\u53ef\u4ee5\u6d4f\u89c8\u5668\u4e2d\u80fd\u591f\u901a\u8fc7http\u6b63\u5e38\u8bbf\u95ee\u670d\u52a1\u5668\u3002<\/p>\n<h3>&#xff08;2&#xff09;\u7533\u8bf7\u8bc1\u4e66<\/h3>\n<p>certbot certonly -a webroot &#8211;webroot-path&#061;\/usr\/local\/nginx\/html -d xxx.com -d www.xxx.com<\/p>\n<p>\u8fd9\u91cc\u7684\u2013webroot-path\u6307\u5b9a\u7f51\u7ad9\u7684\u6839\u76ee\u5f55&#xff0c;\u4f7f\u7528-d\u6765\u6307\u5b9a\u5e94\u7528\u8bc1\u4e66\u7684\u57df\u540d&#xff0c;\u5982\u679c\u6709\u591a\u4e2a&#xff0c;\u4f7f\u7528\u591a\u4e2a-d\u5c31\u53ef\u4ee5&#xff08;\u4e00\u822c\u81f3\u5c11\u5e94\u8be5\u4e24\u4e2a&#xff0c;\u4e00\u4e2a\u6ca1\u6709www\u3001\u4e00\u4e2a\u6709www&#xff09;\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161226-680279ea8ec42.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u6700\u7ec8\u4f1a\u5728 \/etc\/letsencrypt\/live\/xxx.com \u4e0b&#xff0c;\u751f\u6210\u56db\u4e2a PEM \u6587\u4ef6<\/p>\n<p>cert.pem: \u57df\u540d\u8bc1\u4e66 chain.pem&#xff1a;Let\u2019s Enctrypt chain certificate fullchain.pem&#xff1a;cert.pem \u548c chain.pem \u7ec4\u6210 privkey.pem&#xff1a;\u8bc1\u4e66\u7684\u79c1\u94a5<\/p>\n<p>\u6211\u4eec\u9700\u8981\u7528\u5230\u7684\u662f\u540e\u9762\u7684\u4e24\u4e2a&#xff1a;fullchain.pem\u548cprivkey.pem<\/p>\n<h3>&#xff08;3&#xff09;\u5728Nginx\u4e2d\u5e94\u7528\u8bc1\u4e66<\/h3>\n<p>\u8fd9\u4e00\u6b65\u89c1\u4e0b\u4e00\u90e8\u5206\u7684\u5177\u4f53\u914d\u7f6e\u3002<\/p>\n<h3>&#xff08;4&#xff09;\u914d\u7f6e\u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66<\/h3>\n<p>\u56e0\u4e3a Let\u2019s Encrypt \u7684\u8bc1\u4e66\u6709\u6548\u671f\u662f90\u5929&#xff0c;\u5230\u671f\u524d\u8981\u66f4\u65b0\u8bc1\u4e66\u3002certbot \u63d0\u4f9b\u4e86\u66f4\u65b0\u8bc1\u4e66\u7684\u547d\u4ee4 cerbot renew\u3002\u6dfb\u52a0\u4e00\u4e2a conb job \u6765\u5b9e\u73b0\u81ea\u52a8\u66f4\u65b0<\/p>\n<p>crontab -e<\/p>\n<p>\u8f93\u5165<\/p>\n<p>30 2 * * 1 \/usr\/bin\/certbot renew &gt;&gt; \/var\/log\/le-renew.log<\/p>\n<p>35 2 * * 1 \/usr\/bin\/systemctl reload nginx<\/p>\n<p>\u4fdd\u5b58\u5373\u53ef\u521b\u5efa cron job\u3002\u4ee5\u540e\u6bcf\u54681\u7684\u51cc\u66682\u70b930\u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66&#xff0c;2\u70b935\u81ea\u52a8\u91cd\u542fnginx\u3002<\/p>\n<h3>Nginx\u4e0eTomcat\u7ec8\u6781\u6574\u5408<\/h3>\n<p>Nginx\u5bf9\u4e8e\u9759\u6001\u5185\u5bb9\u7684\u5904\u7406\u80fd\u529b\u975e\u5e38\u5f3a&#xff0c;\u8ddfTomcat\u6574\u5408\u6211\u4eec\u4e00\u822c\u4f1a\u5c06\u9759\u6001\u8d44\u6e90\u4ea4\u7ed9Nginx\u6765\u5904\u7406&#xff0c;\u540c\u65f6&#xff0c;\u8003\u8651\u5230\u6211\u4eec\u4f1a\u4f7f\u7528\u9759\u6001\u5316\u6280\u672f\u6765\u5c06\u9875\u9762\u8f6c\u4e3ahtml\u5e76\u4f1a\u7528\u5230\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd&#xff0c;\u6240\u4ee5&#xff0c;\u6211\u4eec\u8981\u5c06Nginx\u76ee\u5f55\u7684\u6743\u9650\u4e5f\u4ea4\u7ed9tomcat\u7528\u6237&#xff0c;\u4ee5\u4fbf\u5176\u53ef\u4ee5\u6b63\u5e38\u5c06\u6587\u4ef6\u5199\u5165\u5230\/usr\/local\/nginx\/html\u76ee\u5f55\u4e0b\u3002<\/p>\n<p>chown -R tomcat:tomcat \/usr\/local\/nginx<\/p>\n<p>\u4fee\u6539\/usr\/local\/nginx\/conf\/nginx.conf&#xff0c;\u5185\u5bb9\u5982\u4e0b&#xff0c;\u6211\u5df2\u7ecf\u5728\u8981\u5173\u6ce8\u7684\u5730\u65b9\u8fdb\u884c\u4e86\u8bf4\u660e\u3002\u8fd9\u4e2a\u914d\u7f6e\u4e3b\u8981\u5b9e\u73b0\u4e86\u4ee5\u4e0b\u51e0\u9879\u529f\u80fd&#xff1a;<\/p>\n<p>&#xff08;1&#xff09;\u4e0eTomcat\u670d\u52a1\u5668\u6574\u5408&#xff08;\u652f\u6301\u96c6\u7fa4&#xff09;<\/p>\n<p>&#xff08;2&#xff09;\u652f\u6301ssl&#xff0c;\u5bf9\u7279\u5b9a\u76ee\u5f55\u5f3a\u5236\u4f7f\u7528https\u534f\u8bae&#xff0c;\u5176\u4ed6\u76ee\u5f55\u5219\u53ef\u4ee5\u5206\u522b\u4f7f\u7528\u4e24\u79cd\u534f\u8bae<\/p>\n<p>&#xff08;3&#xff09;\u4e0ephp\u6574\u5408&#xff0c;\u5bf9phpMyAdmin\u589e\u52a0\u591a\u4e00\u91cdauth basic\u9a8c\u8bc1<\/p>\n<p>#\u6ce8\u610f\u6539\u4e3atomcat<\/p>\n<p>user tomcat;<\/p>\n<p>#\u6839\u636e\u670d\u52a1\u5668CPU\u6570\u91cf\u6765\u8bbe<\/p>\n<p>worker_processes 1;<\/p>\n<p>error_log logs\/error.log;<\/p>\n<p>#\u8fd9\u4e2apid\u8def\u5f84\u8981\u8ddf\/usr\/lib\/systemd\/system\/nginx.service\u4e2d\u7684\u4fdd\u6301\u4e00\u81f4<\/p>\n<p>pid logs\/nginx.pid;<\/p>\n<p>events {<\/p>\n<p>use epoll;<\/p>\n<p>worker_connections 1024;<\/p>\n<p>}<\/p>\n<p>http {<\/p>\n<p>include mime.types;<\/p>\n<p>default_type application\/octet-stream;<\/p>\n<p>log_format main &#039;$remote\\\\_addr &#8211; $remote\\\\_user [$time\\\\_local] &#034;$request&#034; &#039;<\/p>\n<p>&#039;$status $body\\\\_bytes\\\\_sent &#034;$http\\\\_referer&#034; &#039;<\/p>\n<p>&#039;&#034;$http\\\\_user\\\\_agent&#034; &#034;$http\\\\_x\\\\_forwarded\\\\_for&#034;&#039;;<\/p>\n<p>access_log logs\/access.log main;<\/p>\n<p>sendfile on;<\/p>\n<p>tcp_nopush on;<\/p>\n<p>keepalive_timeout 65;<\/p>\n<p>types_hash_max_size 2048;<\/p>\n<p>#\u6ce8\u610f\u8fd9\u91cc\u6211\u4eec\u5305\u542b\u4e86\u4e00\u4e2aproxy.conf\u6587\u4ef6&#xff0c;\u8be5\u6587\u4ef6\u4e5f\u662f\u4f4d\u4e8e\/usr\/local\/nginx\/conf\u76ee\u5f55&#xff0c;\u4e0b\u6587\u4f1a\u8bb2<\/p>\n<p>include proxy.conf;<\/p>\n<p>#\u4e0b\u9762\u8fd9\u5806\u914d\u7f6e\u4e3b\u8981\u7528\u6765\u9650\u5236\u5e76\u53d1\u8fde\u63a5\u6570&#xff0c;\u4ee5\u53ca\u538b\u7f29\u5185\u5bb9\u8282\u7701\u5e26\u5bbd<\/p>\n<p>limit_conn_zone $binary_remote_addr zone&#061;addr:10m;<\/p>\n<p>gzip on;<\/p>\n<p>gzip_min_length 1000;<\/p>\n<p>gzip_comp_level 4;<\/p>\n<p>gzip_types text\/plain text\/css application\/json application\/x-javascript text\/xml application\/xml application\/xml&#043;rss text\/javascript;<\/p>\n<p>open_file_cache max&#061;655350 inactive&#061;20s;<\/p>\n<p>open_file_cache_valid 30s;<\/p>\n<p>open_file_cache_min_uses 2;<\/p>\n<p>#\u5b9a\u4e49Tomcat\u670d\u52a1\u5668\u7684\u4f4d\u7f6e&#xff0c;\u5305\u62ec\u7aef\u53e3\u3001\u6743\u91cd\u3002\u5982\u679c\u8981\u914d\u7f6e\u96c6\u7fa4&#xff0c;\u53ef\u4ee5\u5728\u5176\u4e2d\u589e\u52a0\u591a\u4e2aserver&#xff0c;\u53ea\u8981\u5c06localhost\u6539\u4e3a\u5177\u4f53IP\u5730\u5740\u5e76\u8bbe\u7f6e\u6743\u91cd\u5373\u53ef\u3002\u8fd9\u91cc\u5b9e\u7528\u7684\u662fip\\\\_hash\u65b9\u6848&#xff0c;\u5373\u5bf9\u4e8e\u96c6\u7fa4\u73af\u5883\u4e0b&#xff0c;\u6839\u636eip\u5730\u5740\u6765\u786e\u5b9a\u5185\u5bb9\u8f6c\u4ea4\u7ed9\u54ea\u4e2aTomcat\u5904\u7406\u3002<\/p>\n<p>upstream tomcats{<\/p>\n<p>ip_hash;<\/p>\n<p>server localhost:8080 weight&#061;1;<\/p>\n<p>}<\/p>\n<p>#\u4e0b\u9762\u5b9a\u4e49\u7684\u662f\u9ed8\u8ba4\u76d1\u542c\u7aef\u53e380&#xff0c;\u6211\u4eec\u8981\u6c42\u6240\u6709java action&#xff08;jsp&#xff09;\u4ee5\u53caphp\u90fd\u8d70https\u534f\u8bae&#xff0c;\u56e0\u6b6480\u7aef\u53e3\u4e0b\u653e\u7684\u90fd\u662f\u9759\u6001\u8d44\u6e90&#xff08;html\u3001\u56fe\u7247\u3001js\u7b49&#xff09;&#xff0c;\u56e0\u6b64\u65e0\u987b\u592a\u591a\u7684\u914d\u7f6e\u3002<\/p>\n<p>server{<\/p>\n<p>listen 80;<\/p>\n<p>server_name xxx.com www.xxx.com;<\/p>\n<p>#admin\u76ee\u5f55\u548cphpMyAdmin\u76ee\u5f55\u5f3a\u5236\u4f7f\u7528https\u534f\u8bae<\/p>\n<p>location ~ \/(admin|phpMyAdmin)\/ {<\/p>\n<p>return 301 https:\/\/$server_name$request_uri;<\/p>\n<p>}<\/p>\n<p>#do\u3001jsp\u7b49\u4ea4\u7531Tomcat\u6765\u5904\u7406<\/p>\n<p>location ~ .\\\\*.(do|jsp|action|jspx|shtml)?$ {<\/p>\n<p>proxy_pass http:\/\/tomcats;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>#\u4e0b\u9762\u662f\u76d1\u542chttps\u534f\u8bae&#xff08;\u9ed8\u8ba4443\u7aef\u53e3&#xff09;<\/p>\n<p>server {<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.1k\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf22\u6b21\u3002\u5b89\u88c5jdk\u5b89\u88c5Tomcat\u5b89\u88c5MySQL\u5b89\u88c5PHP\u5b89\u88c5Nginx\u5b89\u88c5SSL\u8bc1\u4e66\u6574\u5408Nginx\u548cTomcat\u6574\u5408\u5b8c\u6210\u540e\uff0c\u670d\u52a1\u5668\u5c06\u53ef\u4ee5\u6ee1\u8db3\u5927\u90e8\u5206\u5e94\u7528\u573a\u666f\u9700\u6c42\u3002\u4ee5\u4e0b\u6848\u4f8b\u4f7f\u7528\u7684\u670d\u52a1\u5668\u662f\u4e00\u6b3e\u7f8e\u56fd\u7684VPS\uff0c\u817e\u8baf\u4e91\u3001\u963f\u91cc\u4e91\u7b49\u4e91\u4e3b\u673a\u642d\u5efa\u8fc7\u7a0b\u4e0e\u4e4b\u7c7b\u4f3c\u3002_centos nginx ssl<\/p>\n","protected":false},"author":2,"featured_media":17634,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[59,117,43],"topic":[],"class_list":["post-17642","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-centos","tag-nginx","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/17642.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.1k\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf22\u6b21\u3002\u5b89\u88c5jdk\u5b89\u88c5Tomcat\u5b89\u88c5MySQL\u5b89\u88c5PHP\u5b89\u88c5Nginx\u5b89\u88c5SSL\u8bc1\u4e66\u6574\u5408Nginx\u548cTomcat\u6574\u5408\u5b8c\u6210\u540e\uff0c\u670d\u52a1\u5668\u5c06\u53ef\u4ee5\u6ee1\u8db3\u5927\u90e8\u5206\u5e94\u7528\u573a\u666f\u9700\u6c42\u3002\u4ee5\u4e0b\u6848\u4f8b\u4f7f\u7528\u7684\u670d\u52a1\u5668\u662f\u4e00\u6b3e\u7f8e\u56fd\u7684VPS\uff0c\u817e\u8baf\u4e91\u3001\u963f\u91cc\u4e91\u7b49\u4e91\u4e3b\u673a\u642d\u5efa\u8fc7\u7a0b\u4e0e\u4e4b\u7c7b\u4f3c\u3002_centos nginx ssl\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/17642.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T16:12:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161225-680279e9d6712.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17642.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/17642.html\",\"name\":\"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T16:12:27+00:00\",\"dateModified\":\"2025-04-18T16:12:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/17642.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/17642.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/17642.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/17642.html","og_locale":"zh_CN","og_type":"article","og_title":"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.1k\u6b21\uff0c\u70b9\u8d5e13\u6b21\uff0c\u6536\u85cf22\u6b21\u3002\u5b89\u88c5jdk\u5b89\u88c5Tomcat\u5b89\u88c5MySQL\u5b89\u88c5PHP\u5b89\u88c5Nginx\u5b89\u88c5SSL\u8bc1\u4e66\u6574\u5408Nginx\u548cTomcat\u6574\u5408\u5b8c\u6210\u540e\uff0c\u670d\u52a1\u5668\u5c06\u53ef\u4ee5\u6ee1\u8db3\u5927\u90e8\u5206\u5e94\u7528\u573a\u666f\u9700\u6c42\u3002\u4ee5\u4e0b\u6848\u4f8b\u4f7f\u7528\u7684\u670d\u52a1\u5668\u662f\u4e00\u6b3e\u7f8e\u56fd\u7684VPS\uff0c\u817e\u8baf\u4e91\u3001\u963f\u91cc\u4e91\u7b49\u4e91\u4e3b\u673a\u642d\u5efa\u8fc7\u7a0b\u4e0e\u4e4b\u7c7b\u4f3c\u3002_centos nginx ssl","og_url":"https:\/\/www.wsisp.com\/helps\/17642.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T16:12:27+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418161225-680279e9d6712.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/17642.html","url":"https:\/\/www.wsisp.com\/helps\/17642.html","name":"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T16:12:27+00:00","dateModified":"2025-04-18T16:12:27+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/17642.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/17642.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/17642.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"CentOS\u642d\u5efa\u5168\u529f\u80fd\u670d\u52a1\u5668\uff08Nginx+Tomcat+PHP+SSL\uff09_centos stream\u5168\u529f\u80fd\u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=17642"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/17642\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/17634"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=17642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=17642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=17642"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=17642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}