Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name your_domain.com;
        location ~ ^/index.php/.*$ {
                        try_files $uri $uri/ /index.php?$args;
        }

        location / {
                rewrite ^/file/(.*) /PF.Base/file/$1 last;
                rewrite ^/static/ajax.php /index.php last;
                rewrite ^/themes/default/(.*) /PF.Base/theme/default/$1 last;
                rewrite ^/(static|theme|module)/(.*) /PF.Base/$1/$2 last;
                rewrite ^/(Apps|themes)/(.*) /PF.Site/$1/$2 last;
                try_files $uri $uri/ /index.php?$query_string;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
		location /PF.Base/file/log {
                deny all;
                return 404;
        }
}

Install on a path of domain: for example http://your_domain.com/your_path/ 

Code Block
server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name your_domain.com;
        location ~ ^/your_path/index.php/.*$ {
                        try_files $uri $uri/ /your_path/index.php?$args;
        }

        location /your_path/ {
                rewrite ^/your_path/file/(.*) /your_path/PF.Base/file/$1 last;
                rewrite ^/your_path/static/ajax.php /your_path/index.php last;
                rewrite ^/your_path/themes/default/(.*) /your_path/PF.Base/theme/default/$1 last;
                rewrite ^/your_path/(static|theme|module)/(.*) /your_path/PF.Base/$1/$2 last;
                rewrite ^/your_path/(Apps|themes)/(.*) /your_path/PF.Site/$1/$2 last;
                try_files $uri $uri/ /your_path/index.php?$query_string;
        }
		location /your_path/PF.Base/file/log {
                deny all;
                return 404;
        }

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

...