1 启动实例

略,注册、启动EC2实例

2 安装nginx、mysql, python3

2.1 安装nginx

  • 安装配置

    1. 安装: sudo apt-get install nginx

    2. 查看是否启动: ps aux|grep nginx

    3. 查看ip地址: ifconfig

  • 启动nginx并且设置开机自启

  1. sudo /etc/init.d/nginx start

  2. sudo chkconfig nginx on

  • 配置nginx
  1. sudo vim /etc/nginx/conf.d/default.conf

  2. 配置文件

  1. server {
  2. listen 80 default_server;
  3. server_name _;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location / {
  7. #root /usr/share/nginx/html;
  8. root /var/www/html;
  9. index index.php index.html index.htm;
  10. }
  11. error_page 404 /404.html;
  12. location = /404.html {
  13. #root /usr/share/nginx/html;
  14. root /var/www/html;
  15. }
  16. # redirect server error pages to the static page /50x.html
  17. #
  18. error_page 500 502 503 504 /50x.html;
  19. location = /50x.html {
  20. #root /usr/share/nginx/html;
  21. root /var/www/html;
  22. }
  23. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  24. #
  25. #location ~ \.php$ {
  26. # proxy_pass http://127.0.0.1;
  27. #}
  28. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  29. #
  30. location ~ \.php$ {
  31. root /var/www/html;
  32. fastcgi_pass 127.0.0.1:9000;
  33. fastcgi_index index.php;
  34. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  35. include fastcgi_params;
  36. }
  37. # deny access to .htaccess files, if Apache's document root
  38. # concurs with nginx's one
  39. #
  40. #location ~ /\.ht {
  41. # deny all;
  42. #}
  43. }

参考链接:[https://segmentfault.com/a/1190000002797601](https://segmentfault.com/a/1190000002797601)

2.2 安装MySQL

  • 基本操作

    1. 安装 sudo yum install mysql mysql-server

    2. 启动mysql: sudo service mysqld start

    3. 设置密码: mysqladmin -u root password “newpassword”

2.3 安装python3

  • 基本操作
  1. sudo yum install python35 python35-pip

  2. pip3 配置: sudo ln -s /usr/bin/pip-3.5 /usr/bin/pip3

参考链接:[https://stackoverflow.com/questions/27669927/how-do-i-install-python3-on-an-aws-ec2-instance](https://stackoverflow.com/questions/27669927/how-do-i-install-python3-on-an-aws-ec2-instance)

3 安装python依赖包

3.1 python3安装pillow错误

  • 安装pillow依赖文件
  1. sudo yum install zlib zlib-devel

  2. sudo yum install libjpeg libjpeg-devel

  3. sudo yum install freetype freetype-deve

参考:[http://m.blog.csdn.net/u011572301/article/details/49962811](http://m.blog.csdn.net/u011572301/article/details/49962811)

  • 安装gcc
  1. sudo yum install gcc

  2. sudo yum install python35-devel

参考:[https://stackoverflow.com/questions/11094718/error-command-gcc-failed-with-exit-status-1-while-installing-eventlet](https://stackoverflow.com/questions/11094718/error-command-gcc-failed-with-exit-status-1-while-installing-eventlet)

4 部署程序

  • 上传程序: scp /home/daisy/full.tar.gz root@172.19.2.75:/home/root