Category Archives: nginx

phpMyAdmin – session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13)

phpMyAdmin – Error

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13)

Try to chown /var/lib/php/session/ with the user who is running httpd.
In my case it was nginx.

chown nginx: /var/lib/php/session/

nginx – failed (13: Permission denied)

In a fresh CENTOS, while installing & testing nginx i’v faced the following error..

2019/10/10 17:54:11 [crit] 18960#0: *1 stat() "/home/www/html/index.php" failed (13: Permission denied), client: 94.61.69.69, server: 51.158.69.69, request: "GET /index.php HTTP/1.1", host: "51.158.69.69"

This is how I’v solved.

chcon -R -t httpd_sys_content_t /home/www/html/

More readings
https://stackoverflow.com/questions/22586166/why-does-nginx-return-a-403-even-though-all-permissions-are-set-properly#answer-26228135

/.well-known/acme-challenge/ – 404

 

1 renew failure(s), 0 parse failure(s)

IMPORTANT NOTES:
 - The following errors were reported by the server:

Domain: subdomain.domain.com
 Type: unauthorized
 Detail: Invalid response from
 http://subdomain.domain.com/.well-known/acme-challenge/XXXXXXX_XXXXXXXX:
 "<!DOCTYPE html>
 <html lang="en">
 <head>
 <title>404 Page Not Found</title>
 <style type="text/css">

::selection{ background-color"

To fix these errors, please make sure that your domain name was
 entered correctly and the DNS A record(s) for that domain
 contain(s) the right IP address.

Try to add the following, inside server{}, on user nginx domain configuration..

location /.well-known/acme-challenge/ {
    try_files $uri /dev/null =404;
}

And reboot nginx… 🙂

letsencrypt renew – 404 – Detail: Invalid response

So!,

letsencrypt renew output

Domain: www.domain.com
Type: unauthorized
Detail: Invalid response from
 http://www.domain.com/.well-known/acme-challenge/WLpdvugG3YzC53RTrZMJcYWsRqcj64vWLw43HNBkMN6:

nginx error log

66.133.XXX.XXX - - [11/Feb/2017:09:33:20 +0100] "GET /.well-known/acme-challenge/WLpdvugG3YzC53RTrZMJcYWsRqcj64vWLw43HNBkMN6 HTTP/1.1" 404 247 "http://www.domain.com/.well-known/acme-challenge/WLpdvugG3YzC53RTrZMJcYWsRqcj64vWLw43HNBkMN6" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"

“Somehow” my domain root has changed.
I had to take a look at /etc/letsencrypt/renewal/domain.com.conf and fix some paths… 🙂

 

Warning: Unknown: open(/var/lib/php/session/ O_RDWR) failed: Permission denied (13)

I was getting the following error on a *fresh* CentOS…

Warning: Unknown: open(/var/lib/php/session/sess_isu2r2bqudeosqvpoo8a67oj02, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0

This will do the work…

chown -R nginx:nobody /var/lib/php/session && chmod -R 770 /var/lib/php/session

CRITICAL | sd-XXXX.host.net | (Return code of 255 is out of bounds)

So!,

My nagios was returning a CRITICAL error on one of my servers…

CRITICAL | sd-XXXX.host.net | (Return code of 255 is out of bounds)

and httpd server wasn’t responding….

I think that problem was on IPTABLES / FAIL2BAN ban list. I had 702 banned IPs…
After I clean them up, everything went okay!

captura-de-ecra%cc%83-2016-11-21-as-19-11-52

I was playing hard with them… my bantime was 3600000 (41d) and my findtime was 60000 (16h)…

 

SSL tutorials

Just bought a SSL certificate for one of my clients….
Here are some useful tutorial links.—

CSR Generation: Using OpenSSL (Apache w/mod_ssl, NGINX, OS X)
https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/1/66/

Nginx CSR Generation using OpenSSL
https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/801/0/nginx-csr-generation-using-openssl

Certificate Installation: Apache & mod_ssl
https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/637/66/

Certificate Installation : NGINX
https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/1091/0/certificate-installation–nginx