LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-15-2015, 12:19 PM   #1
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Rep: Reputation: 18
Error establishing a database connection after installing


ubuntu server 14
nginx
phpmyadmin
mariadb-server

To start my default nginx page worked.
testphp.php (phpinfo) worked, now it's a 404 Not Found.
phpmyadmin worked, now it's Error establishing a database connection
wordpress has never worked it's Error establishing a database connection

I followed this tutorial and then everything went wrong. I am new to nginx, so I'm a little off. I will put two pastebin links for nginx/sites-available (default and wordpress). I will also put image attachments of command line output.

Code:
DEFAULT	FILE

    # You may add here your
    # server {
    #       ...
    # }
    # statements for each of your virtual hosts to this file
     
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # http://wiki.nginx.org/Pitfalls
    # http://wiki.nginx.org/QuickStart
    # http://wiki.nginx.org/Configuration
    #
    # Generally, you will want to move this file somewhere, and start with a clean
    # file but keep this around for reference. Or just disable in sites-enabled.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
     
    server {
            listen 80 default_server;
            listen [::]:80 default_server ipv6only=on;
     
            root /usr/share/nginx/html;
            index index.php index.html index.htm;
     
            # Make site accessible from http://localhost/
            server_name localhost;
     
            location / {
                    # First attempt to serve request as file, then
                    # as directory, then fall back to displaying a 404.
                    try_files $uri $uri/ =404;
                    # Uncomment to enable naxsi on this location
                    # include /etc/nginx/naxsi.rules
            }
     
            # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
            #location /RequestDenied {
            #       proxy_pass http://127.0.0.1:8080;    
            #}
     
            #error_page 404 /404.html;
     
            # redirect server error pages to the static page /50x.html
            #
            #error_page 500 502 503 504 /50x.html;
            #location = /50x.html {
            #       root /usr/share/nginx/html;
            #}
     
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
                    try_files $uri = 404;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
            #
            #       # With php5-cgi alone:
            #       fastcgi_pass 127.0.0.1:9000;
            #       # With php5-fpm:
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    include fastcgi_params;
             }
     
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #       deny all;
            #}
    }
     
     
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #       listen 8000;
    #       listen somename:8080;
    #       server_name somename alias another.alias;
    #       root html;
    #       index index.html index.htm;
    #
    #       location / {
    #               try_files $uri $uri/ =404;
    #       }
    #}
     
     
    # HTTPS server
    #
    #server {
    #       listen 443;
    #       server_name localhost;
    #
    #       root html;
    #       index index.html index.htm;
    #
    #       ssl on;
    #       ssl_certificate cert.pem;
    #       ssl_certificate_key cert.key;
    #
    #       ssl_session_timeout 5m;
    #
    #       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    #       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    #       ssl_prefer_server_ciphers on;
    #
    #       location / {
    #               try_files $uri $uri/ =404;
    #       }
    #}
Code:
	WORDPRESS FILE

    # You may add here your
    # server {
    #       ...
    # }
    # statements for each of your virtual hosts to this file
     
    ##
    # You should look at the following URL's in order to grasp a solid understanding
    # of Nginx configuration files in order to fully unleash the power of Nginx.
    # http://wiki.nginx.org/Pitfalls
    # http://wiki.nginx.org/QuickStart
    # http://wiki.nginx.org/Configuration
    #
    # Generally, you will want to move this file somewhere, and start with a clean
    # file but keep this around for reference. Or just disable in sites-enabled.
    #
    # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
    ##
     
    server {
            listen 80 default_server;
            listen [::]:80 default_server ipv6only=on;
     
            root /var/www/html/wordpress;
            index index.php index.html index.htm;
     
            # Make site accessible from http://localhost/
            server_name localhost;
     
            location / {
                    # First attempt to serve request as file, then
                    # as directory, then fall back to displaying a 404.
                    # try_files $uri $uri/ =404;
                    try_files $uri $uri/ /index.php?q=$uri&$args;
                    # Uncomment to enable naxsi on this location
                    # include /etc/nginx/naxsi.rules
            }
     
            # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
            #location /RequestDenied {
            #       proxy_pass http://127.0.0.1:8080;    
            #}
     
            #error_page 404 /404.html;
     
            # redirect server error pages to the static page /50x.html
            #
            #error_page 500 502 503 504 /50x.html;
            #location = /50x.html {
            #       root /usr/share/nginx/html;
            #}
     
            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            #
            location ~ \.php$ {
                    try_files $uri = 404;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
            #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
            #
            #       # With php5-cgi alone:
            #       fastcgi_pass 127.0.0.1:9000;
            #       # With php5-fpm:
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    include fastcgi_params;
             }
     
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #       deny all;
            #}
    }
     
     
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #       listen 8000;
    #       listen somename:8080;
    #       server_name somename alias another.alias;
    #       root html;
    #       index index.html index.htm;
    #
    #       location / {
    #               try_files $uri $uri/ =404;
    #       }
    #}
     
     
    # HTTPS server
    #
    #server {
    #       listen 443;
    #       server_name localhost;
    #
    #       root html;
    #       index index.html index.htm;
    #
    #       ssl on;
    #       ssl_certificate cert.pem;
    #       ssl_certificate_key cert.key;
    #
    #       ssl_session_timeout 5m;
    #
    #       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    #       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    #       ssl_prefer_server_ciphers on;
    #
    #       location / {
    #               try_files $uri $uri/ =404;
    #       }
    #}
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2015-04-15 12:59:52.png
Views:	62
Size:	68.1 KB
ID:	18123   Click image for larger version

Name:	Screenshot from 2015-04-15 13:02:41.png
Views:	51
Size:	119.8 KB
ID:	18124   Click image for larger version

Name:	Screenshot from 2015-04-15 13:03:42.png
Views:	45
Size:	97.8 KB
ID:	18125   Click image for larger version

Name:	Screenshot from 2015-04-15 13:06:22.png
Views:	45
Size:	93.2 KB
ID:	18126   Click image for larger version

Name:	Screenshot from 2015-04-15 13:08:04.png
Views:	49
Size:	85.5 KB
ID:	18127  

 
Old 04-16-2015, 12:27 PM   #2
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
So the problem is establishing a database connection, unfortunately you don't tell anything about how you try to connect.
Please post the connection info (blank out password, of course), it is in the file /var/www/html/wordpress/wp-config.php

Also check your nginx configuration, seems to me both DEFAULT site and WORDPRESS site has the same url.
 
Old 04-18-2015, 05:06 PM   #3
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Original Poster
Rep: Reputation: 18
The wordpress is wp-config. I don't know why the db is running but not connecting from any script, and the php died.
 
Old 04-19-2015, 02:16 AM   #4
pingu
Senior Member
 
Registered: Jul 2004
Location: Skuttunge SWEDEN
Distribution: Debian preferably
Posts: 1,350

Rep: Reputation: 127Reputation: 127
Please provide us with information regarding your problems!
The title says "Error establishing a database connection after installing", but in the post you talk mainly about nginx.
All you provide is screenshots showing that you have thourougly checked that mariadb is up and running, and the Nginx vhost config.

So please, post the info I requested in my first reply.
For php, just saying "php died" doesn't tell us anything. What do you mean, what have you done, what have you checked etc?
 
  


Reply

Tags
mariadb, php, phpmyadmin, wordpress



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error establishing connection to fortinet VPN mzuhri Linux - Networking 1 04-13-2013 12:22 AM
error establishing an encrypted connection to log in rfaruqui Linux - Newbie 6 04-18-2011 07:54 PM
Remote Desktop Connection hangs on 'Establishing connection...' madala Linux - Networking 1 06-27-2008 03:04 PM
Establishing an ethernet connection mikefoo Linux - Networking 2 11-07-2003 05:58 AM
establishing a internet connection iguarin Linux - Newbie 1 05-20-2003 06:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration