1

I have tried to install civicrm standalone on a Ubuntu server VPS. Both STABLE and RC. Installation run OK (in STABLE version, "core" folder has to be moved from "web" to root). In both cases when I go to url after installation, I have "404 Not found" on url .../civicrm/login. I find no "civicrm/login" in folders. With NIGHTLY version, the not found url has "civicrm/home".

1 Answer 1

0

Do you perchance use nginx?

I ran into the same issue. Hope this below helps.

The .htaccess was of course not used (which was generated by the Civi CRM installer)

Chat GPT had a try at rewriting it for use in an nginx config. Also I use let's encrypt, on an Ubuntu 22.04 machine.

Here is my config, "YOUR_DOMAIN" is inserted, the rest readable:

server {

root /var/www/YOUR_DOMAIN/html;
index index.php index.html index.htm index.nginx-debian.html;

server_name YOUR_DOMAIN;

# Deny access to sensitive files
location ~ \.(inc|info|test|mo|po|sh|sql|tpl|tpl\.php)$ {
    deny all;
}

# Deny access to backup and temporary files (including backup PHP files)
location ~ (\~|\.swp|\.bak|\.orig|\.save)$ {
    deny all;
}

# Deny access to files and directories starting with a dot (except .well-known)
location ~ (^|/)\.(?!well-known) {
    deny all;
}

# Main location block for handling requests
location / {
    try_files $uri $uri/ /index.php?$args;
}

# PHP FastCGI handling
location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTP_AUTHORIZATION $http_authorization;  # Pass HTTP Authorization header
    fastcgi_read_timeout 300;
}

# Deny access to .htaccess files (if any)
location ~ /\.ht {
    deny all;
}

# Error handling for 404 (redirect to index.php)
error_page 404 /index.php;

# Caching for static files (images, CSS, JS, etc.)
location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg)$ {
    expires 2w;
    add_header Pragma public;
    add_header Cache-Control "public";
}

# Extra security headers
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;

# SSL configuration (managed by Certbot)
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

server {
if ($host = YOUR_DOMAIN) {
    return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
listen [::]:80;

server_name YOUR_DOMAIN;
return 404; # managed by Certbot
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.