• Hi there!

    I just passed my website on https. After a bit difficult configuration (on Apache with Nginx reverse proxy), everything seemed okay.

    The problem lay in the admin panel. I can login without any problem, and I see that i’m logged in when viewing the website, but i can’t access to admin panel. I get this error :

    You don’t have the rights to access this page.

    I’m the only user, so i’m the administrator for sure.

    I added this bit to wp-config.php:
    define('FORCE_SSL_ADMIN', true);

    If I remove it, I get this error in the logs:

    PHP Fatal error:  Uncaught Error: Call to undefined function nocache_headers() in /var/www/emmanuelbeziat/site/wp-admin/admin.php:33
    Stack trace:
    #0 /var/www/emmanuelbeziat/site/wp-admin/index.php(10): require_once()
    #1 {main}
    thrown in /var/www/emmanuelbeziat/site/wp-admin/admin.php on line 33

    Here’s the vhost in Apache:

    <VirtualHost 127.0.0.1:8082>
        ServerName www.emmanuelbeziat.com
        ServerAlias www.emmanuelbeziat.com
        ServerAdmin [email protected]
    
        DocumentRoot /var/www/emmanuelbeziat/site
    
        ErrorLog ${APACHE_LOG_DIR}/emmanuelbeziat/site_error.log
        CustomLog ${APACHE_LOG_DIR}/emmanuelbeziat/site_access.log combined
    
        # Configuration WordPress
        <Directory "var/www/emmanuelbeziat/site">
            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteRule ^index\.php$ - [L]
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule . /index.php [L]
            </IfModule>
        </Directory>
    
        # Protection du fichier wp-config
        <Files wp-config.php>
            Require all denied
        </Files>
    </VirtualHost>

    And in Nginx:

    server {
        listen    443 ssl;
        server_name    www.emmanuelbeziat.com;
        access_log    /var/log/nginx/emmanuelbeziat/emmanuelbeziat.access.log;
        error_log    /var/log/nginx/emmanuelbeziat/emmanuelbeziat.nginx_error.log info;
    
        access_log    off;
        location = /favicon.ico    { access_log off; log_not_found off; }
        location / {
            proxy_pass https://127.0.0.1:8082/;
            include /etc/nginx/conf.d/proxy.conf;
            root /var/www/emmanuelbeziat/site;
        }
    
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|txt|srt|swf)$ {
            root /var/www/emmanuelbeziat/site/;
            expires 30d;
        }
    
        ssl_certificate /etc/letsencrypt/live/emmanuelbeziat.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/emmanuelbeziat.com/privkey.pem;
    
    }
    
    server{
        listen 80;
        server_name emmanuelbeziat.com www.emmanuelbeziat.com;
    
        location / {
            rewrite ^(.*)$ https://www.emmanuelbeziat.com$1 permanent;
        }
    }

    And here’s a phpinfo() with some stuff.

    If you need more configuration file, i’ll put it up here.

    If someone have and idea, thanks in advance!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Unable to access admin with ssl’ is closed to new replies.