AddHandler application/x-httpd-php .htm in nginx?

That command in apache htaccess allows to read htm files as php,so then
you can load php file with extension htm.How do i enable this on nginx?

On Fri, Mar 26, 2010 at 6:48 AM, Luka H. [email protected]
wrote:

That command in apache htaccess allows to read htm files as php,so then
you can load php file with extension htm.How do i enable this on nginx?

location ~ .htm$ {
fastcgi_pass …

}


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Edho P Arief wrote:

On Fri, Mar 26, 2010 at 6:48 AM, Luka H. [email protected]
wrote:

That command in apache htaccess allows to read htm files as php,so then
you can load php file with extension htm.How do i enable this on nginx?

location ~ .htm$ {
fastcgi_pass …

}


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

Forgot to say how i tried following:
location ~ .htm$ {
root /location;
fastcgi_pass 127.0.0.1:9000;

        fastcgi_param  SCRIPT_FILENAME 

/location$fastcgi_script_name;
include fastcgi_params;
}
It didn’t work,it still read php file as html file.On the other hand,i
bet it would work if i would pick some misc extension like php2.

On Fri, 2010-03-26 at 11:10 +0100, Luka H. wrote:

}
/location$fastcgi_script_name;
include fastcgi_params;
}
It didn’t work,it still read php file as html file.On the other hand,i
bet it would work if i would pick some misc extension like php2.

This will work. The extension is irrelevant to Nginx. Perhaps you
should post your entire config. Also, be 100% certain you are not
encountering browser caching (this catches me out now and again).

Cliff

Do not have a solution. I have the same problem as well.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,67909,120819#msg-120819

my nginx.conf

#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;
    gzip_min_length  10240;
    gzip_buffers     64k;
    gzip_types       application/x-javascript text/css text/xml
text/plain;


    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  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;
        #}

        # 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;
            include        fastcgi.conf;
        }

        # 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;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,67909,121039#msg-121039

This config does not have any

location ~ .htm$ { }

Please post the actual, real config you are using. Trying to debug a
phony config is a waste of time.

Cliff

On Wed, 2010-08-18 at 13:31 -0400, codetr wrote:

#log_format  main  '$remote_addr - $remote_user [$time_local]
keepalive_timeout  65;
    server_name  localhost;

    #
        fastcgi_index  index.php;

#        root   html;

nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx

Yes. worked with this code. Long live the nginx

location ~ \.htm$ {
      root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.htm;
            include        fastcgi.conf;
  }

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,67909,121087#msg-121087

location ~ .htm$ {
root /location;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME
/location$fastcgi_script_name;
include fastcgi_params;
}

Does not exactly how I can not run the sample.
index.htm inside the include file 1.php

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,67909,121037#msg-121037

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs