Konfigurasi Nginx Untuk Instalasi OPENSID - JackMizh/Sisekar GitHub Wiki

Cari dan edit "nginx.conf", umumnya terletak di /etc/nginx untuk server Linux (https://github.com/OpenSID/OpenSID/issues/846#issuecomment-371450073).

Cari " location / { " dengan server_name yang sesuai dengan domain, tambahkan di bawah kode dibawah :

try_files $uri $uri/ /index.php;

Simpan dan restart nginx anda

CONTOH :

server {
    server_name yoursitename.com;
    root /usr/share/nginx/www/;
    index index.php index.html index.htm;
    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
        expires           15d;
    }

    location ~ \.php$ {
        ...
    }
    ...
}

Saya pakai seperti ini bisa, copy paste + edit dari webnya nginx (https://github.com/OpenSID/OpenSID/issues/846#issuecomment-372101973)

# NGINX CodeIgniter Config

server
{
	server_name opensid.local;

	access_log /var/log/nginx/opensid.local.access.log;

	root /opt/web/OpenSID;

	index index.php index.html index.htm;

	# enforce www (exclude certain subdomains)
#	if ($host !~* ^(www|subdomain))
#	{
#		rewrite ^/(.*)$ $scheme://www.$host/$1 permanent;
#	}

	# enforce NO www
	if ($host ~* ^www\.(.*))
	{
		set $host_without_www $1;
		rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
	}

	# if your default controller is something other than "welcome" you should change the following
	if ($request_uri ~* ^(/welcome(/index)?|/index(.php)?)/?$)
	{
		rewrite ^(.*)$ / permanent;
	}

	# removes trailing "index" from all controllers
	if ($request_uri ~* index/?$)
	{
		rewrite ^/(.*)/index/?$ /$1 permanent;
	}

	# removes trailing slashes (prevents SEO duplicate content issues)
	if (!-d $request_filename)
	{
		rewrite ^/(.+)/$ /$1 permanent;
	}

	# removes access to "system" folder, also allows a "System.php" controller
	if ($request_uri ~* ^/system)
	{
		rewrite ^/(.*)$ /index.php?/$1 last;
		break;
	}

	# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
	if (!-e $request_filename)
	{
		rewrite ^/(.*)$ /index.php?/$1 last;
		break;
	}

	# catch all
	error_page 404 /index.php;

	# use fastcgi for all php files
	location ~ \.php$
	{
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME /opt/web/OpenSID$fastcgi_script_name;
		include fastcgi_params;
	}

	# deny access to apache .htaccess files
	location ~ /\.ht
	{
		deny all;
	}
}