# yum update
# yum install gcc 用來編譯python3.6源碼 # yum install lrzsz 用來上傳文件
# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
# sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
# sudo yum install mysql-server
# chown root /var/lib/mysql/
# service mysqld restart
# mysql -u root -p (回車 無密碼登陸) # mysql > use mysql; # mysql > update user set password=password('123456') where user='root'; # mysql > exit;
# service mysqld restart
mysql>use mysql; mysql>GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";
[client] default-character-set=utf8 [mysqld] character-set-server=utf8 collation-server=utf8_general_ci
重啓mysql服務後才生效javascript
service mysqld restart
查看字符集php
show variables like 'character%';
# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
# mkdir -p /usr/local/Python3
# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
# tar -zxvf Python-3.6.1.tgz # cd Python-3.6.5 # ./configure --prefix=/usr/local/Python3 # make # make install
# ln -s /usr/local/Python3/bin/python3 /usr/bin/python3
# vim ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/Python3/bin
# source ~/.bash_profile
# python3 -V # pip3 -V
# pip3 install —-upgrade pip
# pip3 install virtualenv
# mkdir -p /data # mkdir -p /data/pyenv # virtualenv -p /usr/local/Python3/bin/python3 /data/pyenv/
# ln -s /data/pyenv/bin/activate /usr/bin/activate
# source activate
# deactivate
# mkdir -p /data/wwwroot 用來存放項目文件 # pip3 install Django 3 pip3 install pymysql
# python3 manage.py makemigrations # python3 manage.py migrate # python3 mange.py runserver 0.0.0.0:80
# pip3 install uwsgi
# uwsgi --http 0.0.0.0:80 --file maci_proj/wsgi.py --static-map=/static=static
# cd /data/wwwroot/ # mkdir maci 建立項目目錄 # cd maci # mkdir script # cd script # vim uwsgi.ini
編寫啓動文件:css
[uwsgi] # 項目目錄 chdir=/data/wwwroot/maci/maci_proj # 指定項目的application module=軍民.wsgi:application # 指定sock的文件路徑 socket=/data/wwwroot/maci/script/uwsgi.sock # 進程個數 workers=5 pidfile=/data/wwwroot/maci/script/uwsgi.pid # 指定IP端口 http=172.18.43.213:8000 #http=47.106.128.221:80 # 指定靜態文件 #static-map=/static=/data/wwwroot/smcic/smcic_pro/static static-map=/static=/data/wwwroot/maci/maci_proj/static # 啓動uwsgi的用戶名和用戶組 uid=root gid=root # 啓用主進程 master=true # 自動移除unix Socket和pid文件當服務中止的時候 vacuum=true # 序列化接受的內容,若是可能的話 thunder-lock=true # 啓用線程 enable-threads=true # 設置自中斷時間 harakiri=30 # 設置緩衝 post-buffering=4096 # 設置日誌目錄 daemonize=/data/wwwroot/maci/script/uwsgi.log
啓動:uwsgi —ini 啓動文件名.ini 中止:uwsgi —stop 啓動文件名.pid
# vim /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo # 下面這行centos根據你本身的操做系統修改 好比:OS/rehel # 7是你本身Linux系統的版本,能夠經過URL查看路徑是否正確 baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enable=1
# yum -y install nginx
# nginx
# cd /etc/nginx/conf.d/
# vim xxx.conf
server { # 這個server標識我要配置了 listen 80; # 我要監聽那個端口 server_name 47.106.128.221 ; # 你訪問的路徑前面的url名稱 access_log /var/log/nginx/access.log main; # Nginx日誌配置 charset utf-8; # Nginx編碼 gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-php application/json text/json image/jpeg image/gif image/png application/octet-stream; # 支持壓縮的類型 error_page 404 /404.html; # 錯誤頁面 error_page 500 502 503 504 /50x.html; # 錯誤頁面 # 指定項目路徑uwsgi location / { # 這個location就和我們Django的url(r'^admin/', admin.site.urls), include uwsgi_params; # 導入一個Nginx模塊他是用來和uWSGI進行通信的 uwsgi_connect_timeout 30; # 設置鏈接uWSGI超時時間 uwsgi_pass unix:/data/wwwroot/maci/script/uwsgi.sock; # 指定uwsgi的sock>文件全部動態請求就會直接丟給他 } # 指定靜態文件路徑 location /static/ { alias /data/wwwroot/maci/maci_proj/static/; #index index.html index.htm; } }
# nginx 啓動 # systemctl start nginx.service 啓動 # systemctl enable nginx.service 開機自啓動 # nginx -s reload 更新配置文件