「俺がGUNDAMだ!」かどうかは分からないけどLEMP作ってみる(その2)

かなり中途半端な状態でその1が終わりw 中核のEMPをサクッとやりますか?
「M」入れます。MySQLです。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
root@dti-vps-XXX:/home/hoge# apt-get install mysql-server php5-mysql root@dti-vps-XXX:/home/hoge# mysql_install_db root@dti-vps-srv715:/home/tkymgr# /usr/bin/mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! |
なんか、だんだんインストールログになってきたw 次に「E」いれまうs。EnginX入れます。その前に、http://AAA.BBB.CCC.DDDにアクセスしても、エラーになることを確認しておく。
1 2 |
root@dti-vps-XXX:/home/hoge# apt-get install nginx root@dti-vps-XXX:/home/hoge# service nginx start |
あらためて、http://AAA.BBB.CCC.DDDにアクセスしてみてサービスが起動してることを確認する。
次はあれか。「P」か。PHPいれます。
1 |
root@dti-vps-XXX:/home/hoge# apt-get install php5-fpm |
設定ファイルを編集する。
1 2 3 |
root@dti-vps-XXX:/home/hoge# vi /etc/php5/fpm/pool.d/www.conf listen = /var/run/php5-fpm.sock ← 127.0.0.1:9000となってるのを変更 |
サービスの再起動
1 |
root@dti-vps-XXX:/home/hoge# service php5-fpm restart |
最後に、FastCGI的な設定をする。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
root@dti-vps-XXX:/home/hoge# vi /etc/nginx/sites-available/default --- 中略 ---- server { #listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 root /usr/share/nginx/www; 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 index.html try_files $uri $uri/ /index.html; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } # Only for nginx-naxsi : process denied requests #location /RequestDenied { # For example, return an error code #return 418; #} #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/www; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { # 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; #} } --- 中略 ---- |
index.php追加したり、コメント外したりした(ような気がする…)。変更したのがあってるかどうか、確認する。OK的な感じだったら、サービスを再起動する。
1 2 3 4 |
root@dti-vps-XXX:/home/hoge# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful root@dti-vps-XXX:/home/hoge# service nginx start |
いつものテストプログラムを作成して確認。
1 2 3 |
vi /usr/share/nginx/www/info.php <?php phpinfo(); ?> |
http://AAA.BBB.CCC.DDD/info.phpにアクセスして、確認する。
最後に、phpmyadmin入れとく。
1 2 |
root@dti-vps-XXX:/home/hoge# apt-get install phpmyadmin root@dti-vps-XXX:/home/hoge# ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www/ |
http://AAA.BBB.CCC.DDD/phpmyadmin/にアクセスして確認。
最後は、WordPress入れればいいんだよね? (続く)
-
前の記事
「俺がGUNDAMだ!」かどうかは分からないけどLEMP作ってみる(その1) 2014.01.30
-
次の記事
下り最速!anzu Kernel 2014.02.16
コメントを書く