Skip to content

Instantly share code, notes, and snippets.

@mrskl21
mrskl21 / gist:b99c186476af7302a72f89e16c310a1a
Created November 20, 2023 08:11
Codeigniter 3x Nginx Config for subdirectory
server {
listen 8081;
listen [::]:8081;
server_name _;
root /var/www/main_directory;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
<?php
$base_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$base_url .= "://". @$_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;