【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

Mathjax改造

Mathjax for WordPress插件的开发者认为,$...$标签可能与$货币符号混淆,故用$latex标记公式。

为了通用性和简洁性,我通过插件改造把$latex改回了$,但又兼容已经书写过公式的既有文章。

主要改动是\$latex[= ](.*?[^\\\\])\$改为\$(latex){0,1}[= ](.*?[^\\\\])\$

$latex a^2 $
$ a^2 $

【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;
    }
    }

【160123】服务器管理记录

  • Ubuntu Server用户管理

    • List all

      cut -d: -f1 /etc/passwd

    • Create

      sudo useradd [username]
      sudo passwd [username]

    • Delete

      sudo userdel [username]
      sudo rm -rf /home/[username]

    • List UIDs

      awk -F: ‘//home/ {printf “%s:%s\n”,$1,$3}’ /etc/passwd

  • 使用vsftpd搭建ftp服务

    • Install

      sudo apt-get update
      sudo apt-get install vsftpd

    • Configure

      sudo nano /etc/vsftpd.conf

      Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to NO:

    anonymous_enable=NO

      Disallow anonymous, unidentified users to access files via FTP; change the anonymous_enable setting to
    

Allow local uses to login by changing the local_enable setting to YES:
> local_enable=YES

    If you want local user to be able to write to a directory, then change the write_enable setting to YES:
> write_enable=YES

    [Solve `530 Login incorrect`](http://askubuntu.com/questions/413677/vsftpd-530-login-incorrect):
> pam_service_name=ftp

    [Solve `550 failed to change directory`](http://my.oschina.net/aiguozhe/blog/100161)
> chroot_local_user=NO

- Run
> sudo service vsftpd restart[/start/stop]

【160118】服务器管理记录

  • 更换系统
    再也无法忍受Windows 2008 Server x86,将其逐出门外为快。

  • ssh初步

ssh [username]@[IP Address]

scp [filename] [username]@[IP Address]:[directory]

  • apache,mysql,php部署





  • 设置默认访问【?】页面

    如图所示,将index.php提前,那么访问该目录时将优先转向此页面。

  • unzip

【160113】PrintService开发记录

第一次发日志,就从【应用过PrintService的】校赛以后说起吧;不折腾不舒服。

程序设计校赛办完了……

努力赶完了各种超乎预料的活。

命题

写标程吃力;惊讶于自己写标程时的乏力,低级算法竟事倍功半。
编数据时用py写了生成器(可据此认为是真正地学到了一些Python)
但是,小数转分数的输出数据的错误,直到比赛进行中才发现。

判题系统

比起之前在云服务器上的糟糕透顶的测试情况,是令人欣慰的。
但是在不同机器上运行同一份代码,竟会有不同的结果;还有错综复杂的Compilation Error。
自动更新榜单的功能是良好的,但不接受中文(无论UTF-8还是ANSI/GB2312编码)的Display Name的特性是恶劣的。
注意性能瓶颈,服务器尽量少承担任务。

网页开发

事到临头方才探索动态页面开发、后端数据处理,是折磨的。
榜单页面的样式并没有时间完成,不直观,不堪入目。
打印页面(此处有预览)终于还是稳定运行了,尽管交互性能极其有限。