By santhosh2116
the follwing is from
How can I use the script on the NGINX server?
NGINX server does not support .htaccess, so if you upload script files to your server, you will 404 error for all your links. In order for your links to work, you need to make some settings on your server.
server {
server_name domain.tld;
root /var/www/codeignitor;
index index.html index.php;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
}
After this, make sure that your “application/config/config.php” file contains the following information:
$config['base_url'] = "http://domain.tld/";
$config['index_page'] = "";
$config['uri_protocol'] = "REQUEST_URI";
An alternative configuration, production ready. You don’t need to modify “config.php”, except for removing “index.php”
$config['base_url'] = "";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
server {
listen 80;
server_name localhost;
root /var/www/html/ci;
autoindex on;
index index.php;
location / {
try_files $uri $uri/ /index.php;
location = /index.php {
fastcgi_pass 127.0.0.1:6969;
fastcgi_param SCRIPT_FILENAME /var/www/html/ci$fastcgi_script_name;
include fastcgi_params;
}
}
location ~ \.php$ {
return 444;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there @santhosh2116,
As recomended in the official documentation, what I could suggest is to try and change the try_files rules to:
try_files $uri $uri/ /index.php$is_args$args;
Let me know how it goes. Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.