1 启动实例
略,注册、启动EC2实例
2 安装nginx、mysql, python3
2.1 安装nginx
安装配置
安装: sudo apt-get install nginx
查看是否启动: ps aux|grep nginx
查看ip地址: ifconfig
启动nginx并且设置开机自启
sudo /etc/init.d/nginx start
sudo chkconfig nginx on
- 配置nginx
sudo vim /etc/nginx/conf.d/default.conf
配置文件
server {
listen 80 default_server;
server_name _;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root /usr/share/nginx/html;
root /var/www/html;
index index.php index.html index.htm;
}
error_page 404 /404.html;
location = /404.html {
#root /usr/share/nginx/html;
root /var/www/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/html;
root /var/www/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
参考链接:[https://segmentfault.com/a/1190000002797601](https://segmentfault.com/a/1190000002797601)
2.2 安装MySQL
基本操作
安装 sudo yum install mysql mysql-server
启动mysql: sudo service mysqld start
设置密码: mysqladmin -u root password “newpassword”
2.3 安装python3
- 基本操作
sudo yum install python35 python35-pip
pip3 配置: sudo ln -s /usr/bin/pip-3.5 /usr/bin/pip3
3 安装python依赖包
3.1 python3安装pillow错误
- 安装pillow依赖文件
sudo yum install zlib zlib-devel
sudo yum install libjpeg libjpeg-devel
sudo yum install freetype freetype-deve
- 安装gcc
sudo yum install gcc
sudo yum install python35-devel
4 部署程序
- 上传程序: scp /home/daisy/full.tar.gz root@172.19.2.75:/home/root