错误提示
Reload service nginx... nginx: [emerg] "http" directive is not allowed here in
使用的是
lnmp.org 一键安装包!
去掉 http 那块 反代是可以的。。。现在想设置缓存空间大小与指定目录就错误了。
http
{
proxy_temp_path /tmp/proxy_temp_dir;
proxy_cache_path /tmp/proxy_cache_dir levels=1:2 keys_zone=nginx_cache8:10m inactive=3d max_size=30g loader_files=100 loader_threshold=200ms loader_sleep=50ms;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
}
server
{
listen 80;
#listen [::]:80;
server_name
jp.xz.adbadb.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/jp.xz.adbadb.com;
include none.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
location / {
proxy_pass
http://xz.adbadb.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}