(参考资源:https://pan.baidu.com/s/1UanYjAKg1uui3KA6_T88Yg)
一.安装jdk
安装资源包提供的jdk。
二.安装tomcat
1.安装资源包提供的tomcat9.
2.申请腾讯云证书网址
https://cloud.tencent.com/product/ssl
3.配置证书(多虚拟主机)
server.xml内容
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" defaultSSLHostConfigName="name1">
<SSLHostConfig hostName="name1">
<Certificate certificateKeystoreFile="conf/name1.jks"
certificateKeystorePassword="pwd"
type="RSA" />
</SSLHostConfig>
<SSLHostConfig hostName="name2">
<Certificate certificateKeystoreFile="conf/name2.jks"
certificateKeystorePassword="pwd"
type="RSA" />
</SSLHostConfig>
</Connector>
4.配置强制ssl访问
tomcat web.xml内容
<login-config>
<!-- Authorization setting for SSL -->
<auth-method>CLIENT-CERT</auth-method>
<realm-name>Client Cert Users-onlyArea</realm-name>
</login-config>
<security-constraint>
<!-- Authorization setting for SSL -->
<web-resource-collection >
<web-resource-name>SSL</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
三.安装mysql
1.安装资源包提供的vcredit.exe(vc2013)
2.正常流程安装mysql
四.tomcat整合php
(参考文档:https://blog.csdn.net/rznice/article/details/40650737)
将php解压到tomcat的根目录下,将文件夹名字改为php
把php.exe所在的路径加入到path中。
将php.ini-development 复制一份。改名php.ini
打开 extension_dir = "ext" 这个选项
修改cgi.force_redirect 为这样 cgi.force_redirect = 0
修改tomcat/conf/context.xml文件
将<Context >加上 privileged="true" 属性即:<Context privileged="true">
在<web-app>中加入
- <servlet>
- <servlet-name>php</servlet-name>
- <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
- <init-param>
- <param-name>clientInputTimeout</param-name>
- <param-value>200</param-value>
- </init-param>
- <init-param>
- <param-name>debug</param-name>
- <param-value>0</param-value>
- </init-param>
- <init-param>
- <param-name>executable</param-name>
- <param-value>D:\tomcat\php\php-cgi.exe</param-value>
- </init-param>
- <init-param>
- <param-name>passShellEnvironment</param-name>
- <param-value>true</param-value>
- </init-param>
- <init-param>
- <param-name>cgiPathPrefix</param-name>
- <param-value>WEB-INF/phpbin</param-value>
- </init-param>
- <load-on-startup>5</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>php</servlet-name>
- <url-pattern>/phpbin/*</url-pattern>
- </servlet-mapping>
重启tomcat服务:
在webapps\ROOT\WEB-INF 下新建一个phpbin的文件夹
在下面新建一个index.php
里面的内容为:
- <?php phpinfo();?>
http://localhost:8080/phpbin/index.php 看到以下内容。说明部署成功: