OJS and Nginx

Im decide to put web server nginx to OJS , make some rewrite there is problem with preety url with OJS

as you can see here :


and  it must be : disable_path_info = On

but i dont want it ,  and then i try to search google and this the link usage for me :


Great article and there is 2 point when value path_info and scriptname : null ...
how to made rewrite in full configuration nginx.conf ?

# Events Module
#   http://wiki.nginx.org/NginxHttpEventsModule

events {
    worker_connections  1024;

# HTTP Core Module
#   http://wiki.nginx.org/NginxHttpCoreModule

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

access_log on;
#tcp_nodelay on;
keepalive_requests 100000;

    gzip  on;
    gzip_static on;
    gzip_comp_level 9;
    gzip_min_length 1400;
    gzip_types  text/plain text/css image/png image/gif image/jpeg application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_vary  on;
    gzip_http_version 1.1;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    # Load config files from the /etc/nginx/conf.d directory
    include /etc/nginx/conf.d/*.conf;

    # The default server

server {
listen 80;
server_name yourservername.com;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

 root /var/www/html/ojs;
index index.php index.html index.htm;

location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;

location ~ .php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include /etc/nginx/fastcgi_params;

location ~ .php($|/) {

set $script $uri;
set $path_info "";

if ($uri ~ "^(.+.php)(/.+)") {
set $script $1;
set $path_info $2;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$script;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;


Popular posts from this blog

Pushdo and CutWail - Iptables + Nginx + Naxsi

Defend Pushdo and Cutwail - Iptables - Proxy Reverse Server - Nginx + Naxsi