nginx 的安装及与php、jsp 的整合
##vim /etc/nginx/conf.d/jedy.conf \\ 虚拟主机配置文件,内容如下:
################################脚本开始#################################
server{
listen 88;
server_name www.jedy.com jedy.com; \\ 域名配置
index index.html index.htm index.php index.jsp; \\ 增加对index.php index.isp的支持
root /data/webapps/jedy; \\ 网页主目录
charset gb2312;
location ~ .*\.(php|php5)?$ \\ php 支持设置段,此处我们使用php-fpm功能支持php
{
root /data/webapps/jedy;
fastcgi_pass127.0.0.1:9000; \\ php-fpm 端口
fastcgi_index index.php;
fastcgi_paramSCRIPT_FILENAME/data/webapps/jedy$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(jsp|action|do)$ \\ jsp 支持设置段 使用代理方式支持jsp,此后会指定proxy.conf的内容
{ \\ 匹配以jsp action do结尾的,此处根据实际情况
index index.jsp;
proxy_pass http://127.0.0.1:8080; \\ jsp 端口 此处应该是tomcat的端口 当然tomcat得启动了
}
}
################################脚本结束#################################
#
# vim /etc/nginx/conf.d/proxy.conf \\ 设置代理使用配置文件,用于整合jsp,内容如下:
################################脚本开始#################################
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; #获取真实IP
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #获取代理者的真实ip
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
################################脚本结束#################################
#
# vim /etc/nginx/conf.d/ssl.conf \\ 设置ssl配置文件,一般很少用,内容如下
################################脚本开始#################################
# HTTPS server
#
#server {
# listen 443;
# server_namelocalhost;
# ssl on;
# ssl_certificate /etc/nginx/cert.pem;
# ssl_certificate_key/etc/nginx/cert.key;
# ssl_session_timeout5m;
# ssl_protocolsSSLv2 SSLv3 TLSv1;
# ssl_ciphersHIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root /usr/share/nginx/html;
# indexindex.html index.htm;
# }
#}
################################脚本结束#################################
#
# /usr/local/nginx/sbin/nginx \\ 手动启动Nginx
页:
[1]