Reputation: 477
I'm trying to get Drupal9 set up on a Lightsail instance to manage my portfolio. I've got it installed and can load the home Drupal homepage. The problem I'm running into now is that after I navigate to https://example.com
(the homepage), and then try to go to an admin tab like https://example.com/admin/content
, Nginx returns a status 404. This makes sense as there is no location block to handle the directory, but I'm not sure what the next steps would be to serve these pages.
Right now I have the Drupal admin page set up to be served with my base URL, and my server root /home/ubuntu/portfolio/projects/drupal
, but /home/ubuntu/portfolio/projects/drupal/admin/content
(this is where Nginx will try to serve http://example.com/admin/content
from) isn't even a valid file path in the Drupal installation. So I'm not sure how that would ever correctly serve the pages I need.
So my questions are as follows:
Where are the files intended to serve these admin pages located relative to my base Drupal install directory?
What changes should I make to the .conf file below in Nginx to serve them correctly without interfering with other location blocks (or at least without breaking them).
server{
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
listen [::]:443;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
root /home/ubuntu/portfolio/projects/drupal; #show users the resume by default
index index.php;
# Other config you desire (TLS, logging, etc)...
location /resume {
return 302 /resume/;
location /resume/ {
root /home/ubuntu/portfolio;
index index.html;
}
location /weatherapp {
return 302 /weatherapp/;
}
location /weatherapp/ {
root /home/ubuntu/portfolio;
index index.html;
}
location /cryptoDesign {
return 302 /cryptoDesign/;
}
location /cryptoDesign/ {
root /home/ubuntu/portfolio;
index index.html;
}
location ~ '\.php$|^/update.php' {
#return 301 https://google.com;
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
# Ensure the php file exists. Mitigates CVE-2019-11043
try_files $fastcgi_script_name =404;
# Security note: If you're running a version of PHP older than the
# latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini.
# See http://serverfault.com/q/627903/94922 for details.
include fastcgi_params;
# Block httpoxy attacks. See https://httpoxy.org/.
fastcgi_param HTTP_PROXY "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_intercept_errors on;
# PHP 5 socket location.
#fastcgi_pass unix:/var/run/php5-fpm.sock;
# PHP 7 socket location.
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
Upvotes: 0
Views: 260
Reputation: 1
I fixed it myself ... https://groups.drupal.org/node/534429 says you need to put try_files $uri /index.php?$query_string;
in the nginx config. Now I can load the admin pages.
Upvotes: 0