其实不限于centos,个人觉得所有的linux都一样,就好像你喜欢把钱放在左边的口袋,我喜欢把钱放右边的口袋,还有的人喜欢把钱放里面的口袋,无非是配置文件的地方不一样
首先安装nginx,嗯,这个自己装。然后配置好配置文件
配置文件的路径可以用nginx -t来查看:
nginx: the configuration file /alidata/server/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /alidata/server/nginx/conf/nginx.conf test is successful
嗯,对,我用的是阿里云的一键部署,这不是重点
最简单的配置文件就是下面这个样子:
user www www;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /alidata/www;
index index.html index.htm index.php index.asp;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
这样可以访问就可以直接访问地址了,前提是你的root目录(/alidata/www/)下面有index.*的文件,就是网站首页
然后安装uwsgi,不能用源码安装,源码安装会出现访问不了的问题,最简单的就是
easy_install pip && pip install uwsgi
当然,在这之前我们可以测试一下uwsgi是否可以正常工作
先kill掉uwsgi,或者不kill 记得换个端口就行了,写一个测试的test.py: