十一 19

最近这段时间,计算器程序拖拉的半天还未完工,因为二舅逝世了又到常德去了3天,回来天气转冷心情也不咋好,不知道为什么,唉。

教程如下:

1.登录vps,输入console进入控制台

2.输入命令(yourwebsite.com为你的网站)

mkdir /home/wwwroot/yourwebsite.com

3.新建一个用户绑定到你的网站文件夹(这个就是ftp用户),依次执行下列命令(用户名和网站目录需修改):

adduser -d /home/wwwroot/yourwebiste.com -s /sbin/nologin username

passwd username

chown -R username /home/wwwroot/yourwebsite.com

4.新建网站配置文件,输入:

vim /usr/local/nginx/conf/vhosts/yourwebsite.conf

复制以下代码并在记事本中修改(在shell下按右键粘贴):

##s#
server
{
listen 80;
server_name hhacker.com www.hhacker.com;
index index.php index.html index.htm ;
root /home/wwwroot/hhacker.com;

location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}

server_name后面为你想要绑定的域名,可以写多个,每个域名之间用空格空开。
root为网站的虚拟目录,修改为上面已经建立好的文件夹。

按几下esc,输入如下命令(退出并保存)
:wq

5.重启nginx,输入:

kill -HUP `cat /usr/local/nginx/logs/nginx.pid`

6.按ctrl+]退出console,输入exit退出命令行。

3 Responses to “一点唠叨和夜火要的教程”

  1. sink Says:

    呵呵~nice~!

    难道仁兄不想捣鼓下lfs?哈~

  2. hhacker Says:

    lfs很好玩啊 有时间再玩

  3. sink Says:

    嘿嘿……一起一起~

Leave a Reply