{"id":45,"date":"2010-09-10T09:10:17","date_gmt":"2010-09-10T01:10:17","guid":{"rendered":"http:\/\/www.magki.com\/blog\/?p=45"},"modified":"2010-09-10T09:19:08","modified_gmt":"2010-09-10T01:19:08","slug":"some-note-about-linux-server","status":"publish","type":"post","link":"http:\/\/www.ijony.com\/blog\/2010\/09\/some-note-about-linux-server.html","title":{"rendered":"\u8fd1\u671f\u914d\u7f6e linux \u670d\u52a1\u5668\u7684\u4e00\u70b9\u5907\u6ce8"},"content":{"rendered":"<p>\u4e00\u3001PHP.ini<\/p>\n<p>\u67d0\u4e2a\u5ba2\u6237\u6211\u914d\u7f6e\u597d\u4ee5\u540e\u53cd\u6620\u65e0\u6cd5\u4e0a\u4f20\u6587\u4ef6\uff0c\u5177\u4f53\u8868\u73b0\u4e3a $_FILES[&#8216;abc&#8217;][&#8216;tmp_name&#8217;] \u4e3a\u7a7a\u3002\u5224\u65ad\u662f\u6ca1\u6709\u4e34\u65f6\u6587\u4ef6\u5939\u7684\u6743\u9650\u9020\u6210\u7684\u3002\u51e0\u756a\u68c0\u67e5\u6700\u540e\u53d1\u73b0\u539f\u6765\u662f php.ini \u4e2d\u7684 open_basedir \u6ca1\u6709\u628a PHP \u9ed8\u8ba4\u5b58\u653e\u4e34\u65f6\u6587\u4ef6\u7528\u7684 \/tmp\/ \u6587\u4ef6\u5939\u6dfb\u52a0\u8fdb\u53bb\uff0c\u8865\u4e0a\u540e\u95ee\u9898\u89e3\u51b3\u3002<\/p>\n<p>\u4e8c\u3001sed \u547d\u4ee4<\/p>\n<p>\u5728\u7f16\u5199\u4e00\u4e2a\u7528\u4e8e\u5f00\u8bbe\u65b0\u7ad9\u70b9\u7684 shell \u811a\u672c\u65f6\uff0c\u78b0\u5230\u4f7f\u7528 sed \u547d\u4ee4\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u7684\u547d\u4ee4\u884c\u59cb\u7ec8\u65e0\u6cd5\u8c03\u7528\u811a\u672c\u53d8\u91cf\u7684\u95ee\u9898\u3002\u6700\u7ec8\u5728\u7f51\u4e0a\u5076\u7136\u770b\u5230\u539f\u56e0\uff0c\u539f\u6765\u8981\u7528\u53cc\u5f15\u53f7\u3002<br \/>\n<span style=\"color: #ff0000;\">sed -i &#8220;s\/newdomain\/${2}\/g&#8221; \/etc\/nginx\/conf\/vhost\/$1.conf<\/span><\/p>\n<p>\u4e09\u3001\u7528\u4e8e\u5f00\u8bbe\u65b0\u7ad9\u70b9\u7528\u7684 shell \u811a\u672c\u3002\uff08\u521d\u5b66\u7ec3\u624b\uff0c\u5f85\u5b8c\u5584\uff09<br \/>\n<!--more--><\/p>\n<blockquote><p>\n#!\/bin\/sh<\/p>\n<p>if [ -z $1 ]; then<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;no folder name!&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;exit 0<br \/>\nfi<\/p>\n<p>if [ -z $2 ]; then<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;no domain!&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;exit 0<br \/>\nfi<\/p>\n<p>if [ -z $3 ]; then<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;no ftp password!&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;exit 0<br \/>\nfi<\/p>\n<p>if [ -f \/srv\/http\/$1 ]; then<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;echo &#8220;The $1 has exists!&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;exit 0<br \/>\nfi<\/p>\n<p># for web<br \/>\nmkdir \/srv\/http\/$1<br \/>\nchown -R http:http \/srv\/http\/$1<br \/>\nchmod -R 777 \/srv\/http\/$1<br \/>\ncp \/etc\/nginx\/conf\/vhost.conf \/etc\/nginx\/conf\/vhost\/$1.conf<br \/>\nsed -i &#8220;s\/vhost\/${1}\/g&#8221; \/etc\/nginx\/conf\/vhost\/$1.conf<br \/>\nsed -i &#8220;s\/newdomain\/${2}\/g&#8221; \/etc\/nginx\/conf\/vhost\/$1.conf<br \/>\necho &#8220;<?php echo 'hello world!'; ?>&#8221; > \/srv\/http\/$1\/index.php<\/p>\n<p># for ftp<br \/>\necho $1 >> \/etc\/vsftpd.txt<br \/>\necho $3 >> \/etc\/vsftpd.txt<br \/>\ndb_load -T -t hash -f \/etc\/vsftpd.txt \/etc\/vsftpd_login.db<br \/>\necho &#8220;local_root=\/srv\/http\/$1&#8221; > \/etc\/vsftpd_user_conf\/$1<\/p>\n<p># restart all<br \/>\n\/etc\/rc.d\/nginx restart<br \/>\n\/etc\/rc.d\/vsftpd restart\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001PHP.ini \u67d0\u4e2a\u5ba2\u6237\u6211\u914d\u7f6e\u597d\u4ee5\u540e\u53cd\u6620\u65e0\u6cd5\u4e0a\u4f20\u6587\u4ef6\uff0c\u5177\u4f53\u8868\u73b0\u4e3a $_FILES[&#8216;abc&#038;# [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[23,18,19],"_links":{"self":[{"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/posts\/45"}],"collection":[{"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ijony.com\/blog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}