在nginx.conf中苦苦挣扎

时间:2015-06-04 14:55:24

标签: nginx socialengine jelastic

试图让Jelastic上的Nginx与socialengine一起玩得很好。这里有无数的论坛帖子和其他文档,但我已经碰壁了。

未修改的nginx.conf

#user  nobody;
worker_processes  1;

error_log  /var/log/nginx/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    server_tokens off;
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$http_x_forwarded_for - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    # Websocket support
    #upstream websocket {
    #    server 127.0.0.1:<PORT>;
    #}

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
        include /etc/nginx/aliases.conf;

        #location /ws {
        #    proxy_pass http://websocket;
        #    proxy_http_version 1.1;
        #    proxy_set_header Upgrade $http_upgrade;
        #    proxy_set_header Connection "Upgrade";
        #}


        location / {
            root   /var/www/webroot/ROOT;
            index  index.html index.htm index.php;

            location ~ \.php$ {
                location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot/ROOT$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot/ROOT;
            }

        }
        index  index.php index.html index.htm;

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}
    location ~ /\. { deny all; access_log off; log_not_found off; }
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    location ~ \.php$ {
        location ~ /\. { deny all; access_log off; log_not_found off; }
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME /var/www/webroot$fastcgi_script_name;
            fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_param DOCUMENT_ROOT /var/www/webroot;
        }

    }

include /etc/nginx/conf.d/*.conf;

}

这显然是我想要完成的,以便重写socialengine。

location / {

index  index.php index.html index.htm;
if ( $request_uri ~ "/" ) {
rewrite ^(.*)$ /index.php?rewrite=1 last;
}
if (!-e $request_filename) { rewrite ^(.*)$ /index.php?rewrite=1 last;}
 }


location /install/ {
index index.php;
if (!-e $request_filename) { rewrite ^(.*)$ /install/index.php?rewrite=1 last; }
}

这对我来说似乎非常简单,但出于某种原因,我尝试添加这些行(或其中的部分)的任何方式都阻止了nginx服务器重新启动。

0 个答案:

没有答案