Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

To Install phpFox on nginx server, we have to add these rewrite mode to config.

Install on root domain - for example http://your_domain.com/

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;
        }
}

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

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 / {
                # 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;
        }
}

These config is for reference. Base on your OS, OS version, nginx version, other applications on your server, these configurations might be slightly different. You shall contact your hosting provider for more information.

  • No labels