怎样删除网站,国外看新闻app推荐,住建部小程序是什么,做喜报的网站网站代码写完之后就是项目部署#xff0c;主要包括两个方面#xff1a; 1.nginx安装与配置#xff1a; 1、Nginx 安装 系统平台#xff1a;CentOS release 6.6 (Final) 64位。 一、安装编译工具及库文件
yum -y install make zlib zlib-devel gcc-c libtool openssl open…网站代码写完之后就是项目部署主要包括两个方面 1.nginx安装与配置 1、Nginx 安装 系统平台CentOS release 6.6 (Final) 64位。 一、安装编译工具及库文件
yum -y install make zlib zlib-devel gcc-c libtool openssl openssl-devel 二、首先要安装 PCRE PCRE 作用是让 Nginx 支持 Rewrite 功能。 1、下载 PCRE 安装包下载地址 http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[rootbogon src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz 2、解压安装包:
[rootbogon src]# tar zxvf pcre-8.35.tar.gz 3、进入安装包目录
[rootbogon src]# cd pcre-8.35 4、编译安装
[rootbogon pcre-8.35]# ./configure
[rootbogon pcre-8.35]# make make install 5、查看pcre版本
[rootbogon pcre-8.35]# pcre-config --version 安装 Nginx 1、下载 Nginx下载地址http://nginx.org/download/nginx-1.6.2.tar.gz
[rootbogon src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz 2、解压安装包
[rootbogon src]# tar zxvf nginx-1.6.2.tar.gz 3、进入安装包目录
[rootbogon src]# cd nginx-1.6.2 4、编译安装
[rootbogon nginx-1.6.2]# ./configure --prefix/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre/usr/local/src/pcre-8.35
[rootbogon nginx-1.6.2]# make
[rootbogon nginx-1.6.2]# make install 5、查看nginx版本
[rootbogon nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v 到此nginx安装完成。 2.nginx配置 首先进入文件 cd /usr/local/nginx/conf/nginx.conf 编辑带入如下 #user nobody;
worker_processes 1;#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;#log_format main $remote_addr - $remote_user [$time_local] $request # $status $body_bytes_sent $http_referer # $http_user_agent $http_x_forwarded_for;#access_log logs/access.log main;sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;server {listen 80;server_name www.itcast.cn;#charset koi8-r;#access_log logs/host.access.log main;# location / {
# root html;
# index index.html index.htm;
# }
#根目录注意html文件location / {root /var/www/ihome/static/html;index index.html;}
#uwsgi配置iplocation /api {uwsgi_pass 127.0.0.1:5000;include uwsgi_params;}
#静态文件配置静态文件需要迁移到此文件下location /static {alias /var/www/ihome/static;}#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 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 html;# fastcgi_pass 127.0.0.1:9000;# fastcgi_index index.php;# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# include fastcgi_params;#}# deny access to .htaccess files, if Apaches document root# concurs with nginxs one##location ~ /\.ht {# deny all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}}注需要拷贝static文件 cp -r static /var/www/ihome/static
配置好uwsgi后启动nginxsudo sbin/nginx
如需停止sudo sbin/nginx -s stop 2.uwsgi文件创建与配置 1.进入虚拟环境workon 虚拟环境名称
2.创建文件touch uwsgi.ini
3.编辑文件 [uwsgi]
#按照实际情况改动这里只是举例
# uwsgi 启动时所使用的地址与端口
socket 127.0.0.1:8001pidfile uwsgi.pid
daemonize uwsgi.log
# 指向网站目录
chdir /home/python/Desktop/ihome/test4# python 启动程序文件
wsgi-file test4.py# python 程序内用以启动的 application 变量名
callable app# 处理器数
processes 4# 线程数
threads 2#每次修改代码自动reload无需要手动重启
#py-autoreload 1#状态检测地址
stats 127.0.0.1:90014.启动uwsgi: uwsgi --ini uwsgi.ini 5.启动nginx
如需关闭uwsgi: uwsgi --stop uwsgi.pid