实验 :
访问nginx跳转到tomcat (假如事先不知道tomcat的ip)
!!!!nginx的安装以及工作目录我就不再赘述
server {
listen 192.168.140.151:80;
server_name www.xingyun.com;
access_log /data/xingyun/log/access.log combined;
location / {
# root /data/xingyun/basic;
# index index.html index.htm;
proxy_pass http://www.a1.com:8080; #www.a1.com是我的tomcat
}
}
重启nginx后访问即可
如果不成功,可能需要安装http的openssl
yum -y install openssl*
[root@lotus nginx]$ openssl genrsa -des3 -out server.key 1024 # 用于生成rsa私钥文件
[root@lotus nginx]$ openssl req -new -key server.key -out server.csr # openssl req 用于生成证书请求
[root@lotus nginx]$ openssl rsa -in server.key -out server_nopwd.key #利用openssl进行RSA为公钥加密
[root@lotus nginx]$ openssl x509 -req -days 365 -in server.csr -signkey server_nopwd.key -out server.crt
[root@lotus nginx]$ mv server.crt server_nopwd.key /usr/local/nginx/conf/
反正我这没出问题