安装php
(1)在线安装html
$sudo apt-get install nginxpython
Nginx的版本是1.2.1nginx
ubuntu安装Nginx以后的文件结构大体为:web
全部的配置文件都在/etc/nginx下,而且每一个虚拟主机已经安排在了/etc/nginx/sites-available下shell
启动程序文件在/usr/sbin/nginx
ubuntu
日志放在了/var/log/nginx中,分别是access.log和error.log
网络
并已经在/etc/init.d/下建立了启动脚本nginx
app
默认的虚拟主机的目录设置在了/usr/share/nginx/www
dom
(2)源码安装也比较简单,全部文件默认放到/usr/local/nginx目录,也能够本身指定位置
启动
(1)在线安装的启动过程
$sudo /etc/init.d/nginx start #或者下面
sudo service nginx start
(2)源代码安装的启动过程
$cd /usr/local/nginx
$sbin/nginx
虚拟主机
(1)在site-ennable下面建立文件ubuntu.nobsu.net.conf文件,编辑以下:
server { listen 80; server_name ubuntu.nobsu.net; index index.html index.htm index.php; root /data/www/ubuntu_nobsu_net; log_format ubuntu.nobsu.net '$remote_addr - $remote_user [$time_local] $request' '$status $body_bytes_sent $http_referer ' '$http_user_agent $http_x_forwarded_for'; access_log /data/log/ubuntu.nobsu.net.log ubuntu.nobsu.net; }
(2)建立可访问目录
/data/www/ubuntu_nobsu_net/index.html
hello nginx!!
(3)编辑测试域名:
具体过程以下:
一、修改hosts
sudo gedit /etc/hosts
二、添加解析记录( . )
完整案例:127.0.0.1 localhost.localdomain localhost
简洁记录:127.0.0.1 localhost
三、保存后重启网络
sudo /etc/init.d/networking restart
(4)访问:http://ubuntu.nobsu.net/
ok
uwsgi部署python web项目
命令启动:
uwsgi --http :9090 --wsgi-file foobar.py
ini文件方式,建立ini文件:
[uwsgi] socket = 127.0.0.1:3031 chdir = /data/www/yiqiwanshua-py/ wsgi-file = WSGI.py processes = 2 threads = 1 stats = 127.0.0.1:9191
前台启动:
uwsgi uwsgi.ini
后台启动:
uwsgi /app/dataservice/uwsgi.ini -d /app/dataservice/uwsgi.log
看官方文档,很简单:http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html
[参考文献]
http://www.cnblogs.com/languoliang/archive/2013/04/01/nginx.html 安装