我到处都看到 nginx 比 apache 快得多,特别是作为反向代理。但对我来说,情况恰恰相反,我不知道为什么。我做错了吗?
对于一个简单的请求,使用 apache 我得到的时间为45毫秒使用 nginx80毫秒. 时间几乎增加了一倍。
使用浏览器检查“ab -n1000 -c5https://myddomain.de“
Apache 2.4.10
Nginx 1.9.10
相关 apache 配置部分:
<VirtualHost *:443>
ServerName mydomain.de
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
ProxyPass / https://myipaddress:8443/prod/public/
ProxyPassReverse / https://myipaddress:8443/prod/public/
SSLEngine on
SSLCertificateFile /blablcert.pem
SSLCertificateKeyFile /blablaprivkey.pem
</VirtualHost>
Nginx 配置:
server {
# SSL configuration
#
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /blablacert.pem;
ssl_certificate_key /blablaprivkey.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl on;
server_name mydomain.de;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://myipaddress:8443/prod/public/;
proxy_read_timeout 90;
}
}