Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx Domains Permission related doubt and issues

Discussion in 'Install & Upgrades or Pre-Install Questions' started by Saahib, Oct 8, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    also anything in your mysql error logs ?

    For CentOS 6 only.
    Code (Text):
    tail -500 /var/lib/mysql/YOURHOSTNAME.err
    

    or
    Code (Text):
    tail -500 /var/log/mysqld.log
    
     
  2. Saahib

    Saahib New Member

    17
    2
    3
    Oct 8, 2017
    Ratings:
    +2
    Local Time:
    2:39 AM
    1.13
    10.2
    Nothing as such...

    Code (Text):
    # tail -n 20 /var/lib/mysql/server.hostname.err
    171008 22:23:15 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    2017-10-08 22:23:15 139799512057888 [Note] /usr/sbin/mysqld (mysqld 10.1.28-MariaDB) starting as process 4095 ...
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Using mutexes to ref count buffer pool pages
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: The InnoDB memory heap is disabled
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Using Linux native AIO
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Using generic crc32 instructions
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Initializing buffer pool, size = 1.0G
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Completed initialization of buffer pool
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Highest supported file format is Barracuda.
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: 128 rollback segment(s) are active.
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB: Waiting for purge to start
    2017-10-08 22:23:15 139799512057888 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 198978530
    2017-10-08 22:23:15 139796815017728 [Note] InnoDB: Dumping buffer pool(s) not yet started
    2017-10-08 22:23:15 139799512057888 [Note] Plugin 'FEEDBACK' is disabled.
    2017-10-08 22:23:15 139799512057888 [Note] Server socket created on IP: '::'.
    2017-10-08 22:23:15 139799512057888 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '10.1.28-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
    


    Code (Text):
     #tail -10 /var/log/mysqld.log
    2017-10-08  8:06:15 140036621249280 [Note] /usr/sbin/mysqld: Normal shutdown
    
    2017-10-08  8:06:15 140036621249280 [Note] Event Scheduler: Purging the queue. 0 events
    2017-10-08  8:06:15 140037993203456 [Note] InnoDB: FTS optimize thread exiting.
    2017-10-08  8:06:15 140036621249280 [Note] InnoDB: Starting shutdown...
    2017-10-08  8:06:16 140036621249280 [Note] InnoDB: Waiting for page_cleaner to finish flushing of buffer pool
    2017-10-08  8:06:18 140036621249280 [Note] InnoDB: Shutdown completed; log sequence number 198714603
    2017-10-08  8:06:18 140036621249280 [Note] /usr/sbin/mysqld: Shutdown complete
    
    171008 08:06:18 mysqld_safe mysqld from pid file /var/lib/mysql/server.hostname.pid ended
     
  3. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    double check /etc/hosts file has this entry too
    Code (Text):
    127.0.0.1 localhost.localdomain localhost
    

    or check php config connecting to 127.0.0.1 instead of localhost

    php is on same server as mariadb mysql server right ?

    also output for command
    Code (Text):
    php --ri mysqli
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    If you have a spare test server, you can try centos 6 with 123.09beta01 fresh install on that and test phpmyadmin.sh addon install and see if that works if it does, then issue is only specific to your problematic server.
     
  5. Saahib

    Saahib New Member

    17
    2
    3
    Oct 8, 2017
    Ratings:
    +2
    Local Time:
    2:39 AM
    1.13
    10.2
    Yes, they are.

    /etc/hosts
    Code (Text):
     cat /etc/hosts
    127.0.0.1 localhost.localdomain localhost localhost4.localdomain4 localhost4
    # Auto-generated hostname. Please do not remove this comment.
    xxx.xxx.xxx server.hostname.com  server.hostname
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    


    with 127.0.0.1, it worked.

    Finally, but my /etc/hosts looks just alright..

    However, I can't change localhost to 127.0.0.1 in code as it is at several places and code is not maintained by me.
     
  6. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    weird can you ping localhost ?
    Code (Text):
    ping -c4 localhost
    

    Code (Text):
    ping -c4 localhost
    PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.014 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.010 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=3 ttl=64 time=0.009 ms
    64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=4 ttl=64 time=0.008 ms
    
    --- localhost.localdomain ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2999ms
    rtt min/avg/max/mdev = 0.008/0.010/0.014/0.003 ms
    
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    Also what are permissions on your /var/lib/mysql directory
    Code (Text):
    ls -lah /var/lib/ | grep mysql
    

    Code (Text):
    ls -lah /var/lib/ | grep mysql
    drwxr-xr-x  7 mysql   mysql   4.0K Oct  8 23:53 mysql
    
     
  8. Saahib

    Saahib New Member

    17
    2
    3
    Oct 8, 2017
    Ratings:
    +2
    Local Time:
    2:39 AM
    1.13
    10.2
    Yes, can ping localhost same yours.

    It differed a little,
    Code (Text):
    # ls -lah /var/lib/ | grep mysql
    drwx------ 24 mysql   root    4.0K Oct  9 01:22 mysql


    Then after changing chown mysql:mysql
    Code (Text):
     ls -lah /var/lib/ | grep mysql
    drwx------ 24 mysql   mysql   4.0K Oct  9 01:28 mysql
    

    But no effect.
    Permission of /var/lib/mysql
    Code (Text):
    ls -lah /var/lib/mysql/ | grep mysql
    drwx------ 24 mysql mysql 4.0K Oct  9 01:22 .
    -rw-rw----  1 mysql mysql  16K Oct  9 01:22 aria_log.00000001
    -rw-rw----  1 mysql mysql   52 Oct  9 01:22 aria_log_control
    -rw-rw----  1 mysql mysql 384M Oct  9 01:22 ib_logfile0
    -rw-rw----  1 mysql mysql 384M Oct  8 08:13 ib_logfile1
    -rw-rw----  1 mysql mysql  74M Oct  9 01:22 ibdata1
    -rw-rw----  1 mysql mysql  52K Oct  9 01:22 server.somehost.com.err
    -rw-rw----  1 mysql mysql    5 Oct  9 01:22 server.somehost.com.pid
    -rw-rw----  1 mysql mysql    0 Oct  8 08:14 multi-master.info
    drwx------  2 mysql root  4.0K Oct  8 22:27 mysql
    srwxrwxrwx  1 mysql mysql    0 Oct  9 01:22 mysql.sock
    -rw-r--r--  1 root  root    15 Oct  8 22:27 mysql_upgrade_info
    drwx------  2 mysql mysql 4.0K Oct  8 22:27 performance_schema
    drwx------  2 mysql mysql 4.0K Oct  9 00:05 pub
    -rw-rw----  1 mysql mysql  24K Oct  9 01:22 tc.log

    Ofourse there are some more listing of my databases there.

    Perhaps, you may see this discussion :
    MySQL cannot connect via "localhost", only 127.0.0.1
    May be based on your expertise, you can suggest me some direction from there..

    Though I have hecked things:
    1. Every user has all three variation with password,
    2. Mysql client is using unix socket
    3. skip-name-resolve is OFF
    4. Using socket=/var/lib/mysql/mysql.sock everywhere.

    Now its weird ..
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    then restart nginx + php-fpm + mysql
    Code (Text):
    nprestart
    mysqlrestart
    
     
  10. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    oh you need to chmod 0755 /var/lib/mysql directory too
     
  11. Saahib

    Saahib New Member

    17
    2
    3
    Oct 8, 2017
    Ratings:
    +2
    Local Time:
    2:39 AM
    1.13
    10.2
    This did the trick, it was hell of a experience and I expected earlier, it is going to be something rather little but have been causing big nuisance.

    Meanwhile looking for solution, I went through whole lot of your documentations in short time, I must say you know your things, specially the way you describe stuff in all docs, its commendable. Otherwise, I have seen good developers but hindered by bad docs.

    Just a note, I found that if I use Filezilla with Auto mode, its corrupting files, I had to shift to "binary" to make transfers. Do you think in pure-ftp turning "ascii modifications" is required ?

    Also, I can assume here that from Mysql 5.5.x to Mariadb 10.1.x, one can safely import database , although I ran mysql-upgrade too.
     
  12. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    Never come across this before what mime type files are you uploading? I don't use filezilla though i use securefx by vandyke

    You're problem was probably the mysqldump with all-datsbases option which forced the wipe all fix. You generally won't have issues with individual database dump and restores

    Thanks been doing server/system related tech support and server optimisation consulting for 16+ yrs which reinforces the ability to explain and document stuff :)
     
  13. Saahib

    Saahib New Member

    17
    2
    3
    Oct 8, 2017
    Ratings:
    +2
    Local Time:
    2:39 AM
    1.13
    10.2
    Actually, issue was created by mysql_install_db during reinitialization of , you have also mentioned there to change permission but some how I missed it.
     
  14. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    i actually updated those instructions after your issue. So my mistake :oops:
     
  15. Saahib

    Saahib New Member

    17
    2
    3
    Oct 8, 2017
    Ratings:
    +2
    Local Time:
    2:39 AM
    1.13
    10.2
    All along I was wondering how I missed it :p

    Anyways, I today deployed on live environment. And sites stopped loading at all. I understand that I need to do php-fpm optimization but when I went to see logs, nothing was there.

    I suppose php-fpm logs are at :
    /var/log/php-fpm/www-error.log

    Global Nginx logs at :
    /usr/local/nginx/logs/error.log

    Nothing was there.. so how do I start , where to looks stuff ?
     
  16. eva2000

    eva2000 Administrator Staff Member

    30,168
    6,785
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,137
    Local Time:
    7:09 AM
    Nginx 1.13.x
    MariaDB 5.5
    what do you mean stop loading, what does web browser say ?

    To troubleshoot Nginx and PHP-FPM issues you'd want to check the domain site's vhost access.log and error.log logs located within directory at /home/nginx/domains/yourdomain.com/logs. You can see a full overview at centminmod.com/configfiles.html

    FAQ item 19 has more info on all Centmin Mod relevant log files locations and how to use tail command to view a sample of the entries.

    Also post the contents of your site's nginx vhost http /usr/local/nginx/conf/conf.d/yourdomain.com.conf and/or /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf in BBCODE CODE tags as outlined at How to use forum BBCODE code tags | Centmin Mod Community