NGINX Redirect

Results 1 to 2 of 2
  1. #1
    Member Jemz is offline
    MemberRank
    May 2014 Join Date
    63Posts

    NGINX Redirect

    I'm trying to create a hotel using NGINX and RevCMS but every time I got to the IP to take a look at it, it just downloads a file called (download).

    Any ideas on how to fix it?

    nginx.conf:
    Code:
    #user  nobody;
    worker_processes  1;
    
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    
    #pid        logs/nginx.pid;
    
    
    
    
    events {
        worker_connections  1024;
    }
    
    
    
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
    
        #access_log  logs/access.log  main;
    
    
        sendfile        on;
        #tcp_nopush     on;
    
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
    
        #gzip  on;
    
    
        server {
            listen       80;
            server_name  localhost;
    
    
            #charset koi8-r;
    
    
            #access_log  logs/host.access.log  main;
            
            location / {
                root   html;
                index  index.html index.htm index.php;
                rewrite ^/(|/)$ /index.php?url=$1;
                rewrite ^/([a-zA-Z0-9_-]+)(|/)$ /index.php?url=$1;
                rewrite ^/(.*)\.htm$ /$1.php;
                rewrite ^/(|/)$ /dash.php?page=$1;
                rewrite ^/([a-zA-Z0-9_-]+)(|/)$ /dash.php?url=$1;
            }
    
    
            #error_page  404              /404.html;
    
    
            #error_page  404              /404.html;
    
    
            # redirect server error pages to the static page /50x.html
            #
    
    
    
    
            # proxy the PHP scripts to Apache listening on 127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://127.0.0.1;
            #}
    
    
            # 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;
            #}
        }
    
    
    
    
        # another virtual host using mix of IP-, name-, and port-based configuration
        #
        #server {
        #    listen       8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;
    
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
    
    
        # HTTPS server
        #
        #server {
        #    listen       443 ssl;
        #    server_name  localhost;
    
    
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;
    
    
        #    ssl_session_cache    shared:SSL:1m;
        #    ssl_session_timeout  5m;
    
    
        #    ssl_ciphers  HIGH:!aNULL:!MD5;
        #    ssl_prefer_server_ciphers  on;
    
    
        #    location / {
        #        root   html;
        #        index  index.html index.htm;
        #    }
        #}
    
    
    }


  2. #2
    Sorcerer Supreme Lewislol is offline
    Member +Rank
    Jul 2013 Join Date
    498Posts

    Re: NGINX Redirect

    This is the NGINX configuration I use
    Works well for me, should work for you.
    Code:
    worker_processes  2;
    worker_rlimit_nofile 10000;
    pid /var/run/nginx.pid;
    
    
    events {
    worker_connections  4000;
    use epoll;
    }
    
    
    http {
    include       mime.types;
    default_type  application/octet-stream;
    keepalive_timeout  65;
    gzip  on;
    
    
    server {
        listen YOURVPSIP:80;
        server_name YOURVPSIP;
       root /var/www/html;
        index index.php index.html index.htm;
    
    
        location / {
          if (!-e $request_filename){
            rewrite ^/(.*)(\.)(.*)$ /index.php?url=$1.$3 last;
          }
        }
    
    
        # use fastcgi for all php files
        location ~ \.php$
        {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param  REDIRECT_STATUS    200;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }
    }



Advertisement