【161110】服务器管理记录

15 Practical Linux cURL Command Examples

typically:

curl -O [url]

MySQL: allow remote connection

allow connection from arbitrary hostname:

mysql>GRANT ALL PRIVILEGES ON . TO ‘[username]‘@’%’ IDENTIFIED BY ‘[password]’ WITH GRANT OPTION;
mysql>FLUSH RIVILEGES

allow connection from specific hostname:

mysql>GRANT ALL PRIVILEGES ON . TO ‘[username]‘@’[hostname]’ IDENTIFIED BY ‘[password]’ WITH GRANT OPTION;
mysql>FLUSH RIVILEGES

How to locate MySQL configuration file?

The file might be in 5 (or more?) locations
/etc/my.cnf
/etc/mysql/my.cnf
$MYSQL_HOME/my.cnf
[datadir]/my.cnf
~/.my.cnf

How to locate Nginx configuration file?

The primary configuration file is /etc/nginx/nginx.conf.
Other possible locations include /opt/nginx/conf/.

How to locate Apache configuration file?

Usually /etc/httpd/conf/httpd.conf.

Create an info.php to reveal Apache environment (risky).

< ?php
phpinfo();
?>

Install Apache2, PHP5 And MySQL Support On CentOS 6.5 (LAMP)

the Apache service is located at /etc/init.d/httpd.

How To Install Linux, nginx, MySQL, PHP (LEMP) stack on CentOS 6

【160226】服务器管理记录

【160221】服务器管理记录

  • MySQL:show columns of a certain datatable:

    show full columns from [tablename];

  • Nginx:remove root directory

    root /usr/share/nginx/html;

    location / {

    fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;

    }

    /etc/init.d/nginx restart

  • Nginx:add rewrite rules for redirecting,map port 8080 into 80.

    server {
    listen 8080;
    server_name localhost_redirect;
    rewrite ^/(.+)/.* /$1 last;
    location / {
    proxy_pass http://127.0.0.1:80;
    proxy_set_header Host $host:80;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    }