Skip to content

Instantly share code, notes, and snippets.

@abdullahicyc
Last active October 3, 2018 17:40
Show Gist options
  • Save abdullahicyc/75aec36363d14edede87535dcbb579fd to your computer and use it in GitHub Desktop.
Save abdullahicyc/75aec36363d14edede87535dcbb579fd to your computer and use it in GitHub Desktop.
Ngnix server configuration for Codeignator & phpmyadmin on localhost
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php;
#server_name example.com;
location / {
try_files $uri $uri/ /index.php;
location = /index.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_read_timeout 60s;
}
}
location /phpmyadmin {
root /var/www/phpmyadmin;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /var/www/phpmyadmin;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /var/www/phpmyadmin;
expires 15d;
}
}
location ~ \.php$ {
return 444;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment