简体   繁体   中英

replacement for php htaccess values in nginx

Okay, I used to use apache - I've now moved over to nginx and I love it, but when it comes to my .htaccess values, I'm completely and utterly stuck.

I have this htaccess file:

php_value auto_prepend_file Resources/Core.php
php_value short_open_tag On

I'm not entirely sure how I can replicate this in nginx. I know I can use the global php.ini file, but I don't want to have it on all the virtual hosts, only one of them.

Thanks, Tom

Actually Tom, NGINX does not consider directory overrides.

You can however change the settings in the virtual hosts settings as:

location ~ \.php$ {
        expires off;
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www//httpdocs/$fastcgi_script_name;
        fastcgi_param  PHP_VALUE   "auto_prepend_file=/var/www/your_folder/Resources/Core.php";
    }

the settings file will be found at '/etc/nginx/sites-available' in a default installation in a Linux server, change and restart NGINX

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM