Alanaktion / phproject

A high performance full-featured project management system
https://www.phproject.org
GNU General Public License v3.0
384 stars 106 forks source link

Problem after install #389

Closed RobertB1 closed 3 years ago

RobertB1 commented 4 years ago

I am trying to install phproject but after I run install.php I’m redirected to http://server/phproject/admin and I get “file not found”.

My config is: Centos 7 up to date PHP 7.4 nginx/1.18.0 MariaDB 10.4

The problem might be something with the url rewrite as described here: https://github.com/Alanaktion/phproject/issues/117 but I don’t know how to solve it on nginx.

I’m using the config file provided, with the extra line: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; which is required in centos for php to work. (By the way, maybe you should add it to the example config).

index index.php;
# Dynamic URLs
location / {
    try_files $uri $uri/ /index.php?$args;
}
location ~ ^/app/(controller|dict|helper|model|view) {
    deny all;
}
location ~ ^/uploads/ {
    deny all;
}
location ~ /\.ht {
    deny all;
}
location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;
    include fastcgi_params;
}

client_max_body_size 64M;

PHP is working OK. I checked it creating an info page.

Any idea?

Thanks!

Alanaktion commented 4 years ago

The example configuration is for running Phproject on its own domain at the root path, so may not work in a subdirectory. I haven't tried running it in a subdirectory in a few years, but it should be possible. How to set it up depends on what else you have in that server block though, it may conflict with any other try_files directives and needs to be explicitly set to work in your subdirectory.

Something like this may work, but it really depends on your setup:

server {
    # ... other non-Phproject location blocks

    location ~ /phproject/(.*) { 
        try_files /phproject/$1 /phproject/index.php?$args; 
        location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_index index.php;
            include fastcgi_params;
        }
    }
}

Ideally you'd also want to account for the deny all; locations in the example configuration, as they can significantly improve the security of the application.

RobertB1 commented 3 years ago

OK, I instaled an exclusive server, put it on the root and it's working. Thank you!