Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpler "php in subdirectory"? #1

Open
trwnh opened this issue Jun 16, 2019 · 0 comments
Open

simpler "php in subdirectory"? #1

trwnh opened this issue Jun 16, 2019 · 0 comments

Comments

@trwnh
Copy link
Owner

trwnh commented Jun 16, 2019

https://save.matbm.net/nsbwoasfiqbc.html?XJW5yw

I've had an issue where a PHP app was at the /virtual folder in my server. The fast_cgi was claiming "file not found".
fastcgi_param SCRIPT_FILENAME $document_root/virtual/$fastcgi_script_name; solved the issue. Since the fast_cgi will search for scripts at the /virtual folder now.

Currently there is phpsub.conf:

location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
}

and example subdirectory config:

# --------------------------------------
# octobercms running in subdirectory
# --------------------------------------
location /october {
alias /srv/http/trwnh.com/october;
try_files $uri $uri/ @october;
include snippets/phpsub.conf;
}
location @october {
rewrite /october/(.*)$
/october/index.php?/$1
last;
}

maybe play around with this to see how modular it could be? just looking at it quickly it seems like the SCRIPT_FILENAME line can be moved out of phpsub.conf and the rewrite block could be eliminated entirely...

also with this config in particular, alias directive may not even be necessary since the folder name and the uri path are the same. perhaps it could be eliminated as well, or a better example used (where the uri is different from the physical path on the system).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant