Codeigniter on Nginx generates https action for form, but not Apache Codeigniter on Nginx generates https action for form, but not Apache codeigniter codeigniter

Codeigniter on Nginx generates https action for form, but not Apache


Assuming you are using the automatic site_url detection, Codeigniter's own http/https detection relies on the $_SERVER['HTTPS'] value to be off if it is in fact set to something, to generate the http for the base_url.

Check your default fastcgi_params (usually /etc/nginx/fastcgi_params), maybe it sets it to an empty string or something other than "off", also you can force this from nginx config with this to be "off":

fastcgi_param  HTTPS off;

If you are using one server block for both the http and https connection inside the nginx's config file, you can use a mapping to create the value you need based on the $scheme variable:

# somewhere inside http { ... }map $scheme $php_https { default off; https on; }

And reference it in the fastcgi_param:

fastcgi_param  HTTPS $php_https;


Check your config.php on the Nginx box vs the Apache box. site_url returns what you have specified in your $config['base_url'] entry in config.php