注意:
情况1:
当后端是独立的php-fpm服务器模块的话
需要fastcgi协议
情况2:
当后端是LAMP的话,使用的就是Apache协议
不需要开启fastcgi模块
直接写个location / {
proxy_pass http://backservers;
}
即可
此次实验安装的Nginx中fastcgi_params不适用此次,所以需要更该:
fastcgi_params模块内容:
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
ab -n 1000 -c 100 http://192.168.253.100/cwy/
测试并发量
测试MySQL连通性:
<?php
$conn = mysql_connect('127.0.0.1','root','');
if ($conn)
echo succ;
else
echo fail;
mysql_close();
?>
使用的是Apache协议:
location /up/ {
proxy_pass http://cwy/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。