留言本

Licess是一个开源爱好者,关注Linux、Linux系统管理、NginxLighttpd、Apache等服务器应用、VPS、MySQLPHP Web开发。喜欢捣鼓一下Linux下各种软件的测试,喜欢Shell写一些脚本,虽然写的很菜;喜欢捣鼓服务器却没钱,只能弄个VPS测试;喜欢PHP的高效、简洁、函数的丰富...,但是写的项目却不多;喜欢......

如果你也喜欢,可以通过右边栏订阅 我的博客

交换链接前请务必添加本站链接:

名字:Licess's Blog
描述:关注Linux、Nginx、PHP、VPS相关,分享技巧心得。
地址:http://blog.licess.org/

  1. 军哥你好
    请问有什么支持IPV6的VPS推荐吗?
    我现在用着YardVPS,很不稳定,22端口经常连不上。网站也常常打不开,但ping的话是可以的,延迟是200ms。
    就是希望能有一个速度快、稳定点的空间,硬盘可以小点,因为我就是准备拿来做代理的。
    谢谢军哥!

  2. 现在博客放在什么主机上啊?很快啊。

    licess Reply:

    @老妖, linode的vps上。

  3. 博主,我刚才在盛大云主机安装好了lnmp包,最后面是显示如下,但是phpMyAdmin无法显示,mysql数据库怎么弄,鄙人代码盲,硬是按照你的教程走到安装完这一步的:
    Install LNMP V0.7 completed! enjoy it.
    =========================================================================
    LNMP V0.7 for Ubuntu VPS , Written by Licess
    =========================================================================

    For more information please visit http://www.lnmp.org/

    lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}
    default mysql root password:12345678
    phpinfo : http://vm-192-168-10-207.shengyun.grandcloud.cn/phpinfo.php
    phpMyAdmin : http://vm-192-168-10-207.shengyun.grandcloud.cn/phpmyadmin/
    Prober : http://vm-192-168-10-207.shengyun.grandcloud.cn/p.php

    The path of some dirs:
    mysql dir: /usr/local/mysql
    php dir: /usr/local/php
    nginx dir: /usr/local/nginx
    web dir : /home/wwwroot

    =========================================================================
    =========================================================================
    Manager for LNMP V0.7 , Written by Licess
    =========================================================================
    LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
    This script is a tool to Manage status of lnmp
    For more information please visit http://www.lnmp.org

    Usage: /root/lnmp {start|stop|reload|restart|kill|status}
    =========================================================================
    Nginx is runing!
    php-fpm is runing!
    * MySQL is not running
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
    tcp6 0 0 :::22 :::* LISTEN

  4. 买vps是linux的好还是windows的好?

    licess Reply:

    @Quarry Equipments, php程序的话linux最合适

  5. licess ,您好
    我装的是一键安装包。在启动php-fpm的时候遇到了

    Starting php_fpm Failed loading /usr/local/ioncube/ioncube_loader_lin_5.3.so: /usr/local/ioncube/ioncube_loader_lin_5.3.so: undefined symbol: zend_resolve_path

    这种错误,请问有什么解决办法么?

    licess Reply:

    @jack, php -v 看一下php是哪个版本
    可能是脚本判断版本错误。

  6. 军哥你好,我一直用你的LNMP装VPS,从0.4用到0.7,挺方便的,谢谢。

    在用的过程中,我发现 /root/vhost.sh 这个脚本有些不方便的地方,就是只能添加网站,不能显示现有的网站也不能删除。
    我尝试着按照你的脚本修改了一个,现在可以显示、添加和删除网站。删除的时候也不用自己输入域名,只要按数字编号就行了。
    我把代码都发在这里,你看看有没有能用的代码。

    再次感谢军哥及你创建的LNMP一键安装包。

    /root/vhost.sh
    显示、添加及删除LNMP上的网站:

    #!/bin/bash

    get_char() {
    SAVEDSTTY=`stty -g`
    stty -echo
    stty cbreak
    dd if=/dev/tty bs=1 count=1 2> /dev/null
    stty -raw
    stty echo
    stty $SAVEDSTTY
    }

    addVhost() {
    domain="www.lnmp.org"
    echo "Please input domain:"
    read -p "(Default domain: http://www.lnmp.org):" domain
    if [ '' == "$domain" ]; then
    domain="www.lnmp.org"
    fi

    if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then
    echo "==========================="
    echo "domain=$domain"
    echo "==========================="
    else
    echo "==========================="
    echo "$domain is exist!"
    echo "==========================="
    fi

    moredomainame=''
    echo "Do you want to add more domain name? (y/n)"
    read add_more_domainame
    if [ 'y' == "$add_more_domainame" ]; then
    echo "Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):"
    read moredomain
    echo "==========================="
    echo "domain list=$moredomain"
    echo "==========================="
    moredomainame=" $moredomain"
    fi

    vhostdir="/home/wwwroot/$domain"
    echo "Please input the directory for the domain:$domain :"
    read -p "(Default directory: /home/wwwroot/$domain):" vhostdir
    if [ '' == "$vhostdir" ]; then
    vhostdir="/home/wwwroot/$domain"
    fi
    echo "==========================="
    echo "Virtual Host Directory=$vhostdir"
    echo "==========================="

    echo "==========================="
    echo "Allow Rewrite rule? (y/n)"
    echo "==========================="
    read allow_rewrite

    if [ 'n' == "$allow_rewrite" ]; then
    rewrite="none"
    else
    rewrite="other"
    echo "Please input the rewrite of program :"
    echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist."
    read -p "(Default rewrite: other):" rewrite
    if [ '' == rewrite ]; then
    rewrite="other"
    fi
    fi
    echo "==========================="
    echo "You choose rewrite=$rewrite"
    echo "==========================="

    echo "==========================="
    echo "Allow access_log? (y/n)"
    echo "==========================="
    read access_log

    if [ 'n' == "$access_log" ]; then
    al="access_log off;"
    else
    echo "Type access_log name(Default access log file:$domain.log):"
    read al_name
    if [ '' == "$al_name" ]; then
    al_name="$domain"
    fi

    al="log_format $al_name '\$remote_addr - \$remote_user [\$time_local] "\$request" '
    '\$status \$body_bytes_sent "\$http_referer" '
    '"\$http_user_agent" \$http_x_forwarded_for';
    access_log $al_name.log $al_name;"
    fi
    echo "==========================="
    echo You access log file="$al_name.log"
    echo "==========================="

    echo ""
    echo "Press any key to start create virtul host..."
    char=`get_char`

    if [ ! -d /usr/local/nginx/conf/vhost ]; then
    mkdir /usr/local/nginx/conf/vhost
    fi

    echo "Create Virtul Host directory......"
    mkdir -p $vhostdir
    echo "set permissions of Virtual Host directory......"
    chmod -R 755 $vhostdir
    chown -R www:www $vhostdir

    if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then
    echo "Create Virtul Host ReWrite file......"
    touch "/usr/local/nginx/conf/$rewrite.conf"
    echo "Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf."
    else
    echo "You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf"
    fi

    cat >/usr/local/nginx/conf/vhost/$domain.conf<<eof
    server
    {
    listen 80;
    server_name $domain$moredomainame;
    index index.html index.htm index.php default.html default.htm default.php;
    root $vhostdir;

    include $rewrite.conf;
    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;
    }

    $al
    }
    eof

    echo "Test Nginx configure file......"
    /usr/local/nginx/sbin/nginx -t
    echo "...Done!"

    echo "Restart Nginx......"
    kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
    echo "...Done!"

    echo ""
    echo "========================================================================="
    echo "Your domain:$domain"
    echo "Directory of $domain:$vhostdir"
    echo "Add $domain Ok!"
    echo "========================================================================="
    }

    deleteVhost() {
    echo "Type 1...$vhostCount to delete domain:"
    read -p "type other Cancel delete:" domainIndex

    case "$domainIndex" in
    [0-9] ) ;;
    [0-9][0-9] ) ;;
    * ) {
    echo "Cancel delete domain,Exit!"
    echo ""
    exit 0
    };;
    esac

    echo ""
    domain=${vhosts[$domainIndex]}

    if [ 0 == ${#domain} ]; then
    echo "you select a domain that not exists"
    echo "Cancel delete domain,Exit!"
    echo ""
    exit 0
    fi

    vhostfile="/usr/local/nginx/conf/vhost/$domain.conf"
    if [ ! -f "$vhostfile" ]; then
    echo "domain [$domain=vhostfile] din't exists , Exit !"
    exit 1
    fi

    echo "Do you realy want delete domain [$domain]:"
    read -p "Type y/n(Default not,cancel detele and exit),y/n:" confirm
    if [ 'y' != "$confirm" ]; then
    echo "Cancel delete domain [$domain],Exit!"
    exit 1
    fi

    echo "delete domain [$domain] ..."
    rm -rf "$vhostfile"
    echo "... OK!"

    echo "Restart Nginx......"
    kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
    echo "... Done!"
    echo ""

    domaindir="/home/wwwroot/$domain"
    if [ ! -d "$domaindir" ]; then
    exit 1
    fi

    echo "Delete domain dir [$domaindir]?"
    read -p "Default not delete, y/n:" deleteDomainDir
    if [ 'y' != "$deleteDomainDir" ]; then
    echo "Cancel delete domain dir [$domaindir],Exit!"
    exit 1
    fi

    echo "Do you realy want delete domain dir [$domaindir]? the files will lost !"
    read -p "Type y/n(Default not,cancel detele and exit),y/n:" confirm
    if [ 'y' != "$confirm" ]; then
    echo "Cancel delete domain dir [$domaindir],Exit!"
    exit 1
    fi

    echo "delete domain dir [$domaindir] ..."
    rm -rf "$domaindir"
    echo "... OK!"
    echo ""
    }

    doVhost() {
    exit 0
    }

    showVhost() {
    vhostlist=`ls /usr/local/nginx/conf/vhost`
    vhostlist=${vhostlist//\.conf/}

    echo ""
    echo "========================================================================="
    echo "some domains on your server:"

    vhostCount=1
    for vhost in $vhostlist
    do
    echo "[$vhostCount] $vhost"
    vhosts[$vhostCount]=$vhost
    let vhostCount=$vhostCount+1
    done
    let vhostCount=$vhostCount-1

    return 0
    }

    # Check if user is root
    if [ $(id -u) != "0" ]; then
    echo "Error: You must be root to run this script, use sudo sh $0"
    exit 1
    fi

    declare -a vhosts
    vhostCount=0

    clear
    echo "========================================================================="
    echo "Virtual Host Manager for LNMP V0.4 , Written by oldfox126@foxmail.com "
    echo "========================================================================="
    echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux "
    echo "This script is a tool to add virtual host for nginx "
    echo "For more information please visit http://www.lnmp.org/&quot;
    echo ""
    echo "========================================================================="

    case "$1" in
    add)
    addVhost
    ;;
    update)
    addVhost
    ;;
    delete)
    deleteVhost
    ;;
    do)
    doVhost
    ;;
    *)
    showVhost
    echo ""
    echo "Usage: /root/vhost {add|delete|update}"
    read -p "Please Type add,delete,update! or Type Other to Exit:" action

    if [ 'add' == "$action" ]; then
    addVhost
    exit 1
    fi

    if [ 'update' == "$action" ]; then
    addVhost
    exit 1
    fi

    if [ 'delete' == "$action" ]; then
    deleteVhost
    exit 1
    fi

    if [ 'do' == "$action" ]; then
    doVhost
    exit 1
    fi

    echo "Cancel do domain,Exit!"
    esac
    exit

  7. 请教一个问题,我已经看了这里的所有留言,但感觉我的问题没有解决。按你的方法安装的lnmp 后来添加虚拟主机,但是wordpress固定链接不行,只有把wordpress放在/home/wwwroot/下才行,如果我把网站放在 /home/wwwroot/mysite.com/下 include wordpress.conf 加上也没有作用。 请问是怎么回事。 我是在一个IP下添加许多虚拟主机。

    licess Reply:

    @crusher, 用/root/vhost.sh 直接添加域名,提示伪静态的时候输入wordpress即可。

  8. 请问如何升级mysql?

  9. 你好,LNMP一键安装包确实使用方便,但是我想自己手动编译安装LNMP平台,能告诉我各个源码包的configure的选项吗?谢谢?
    PS:网上虽然有很多教程,但是总是报错。

    licess Reply:

    @Dogge, 查看脚本里面都有

  10. 我LNMP 0.6 完全版来装在CentOS5.5上,能成功运行,但有个很大的问题:
    非本机访问网页第一次可以访问,刷新2下就会导致服务器重启了,而本机访问页面多少次都不会出现该问题,当前内存只用到20%多

  11. Reload LNMP...
    Reload Nginx configure...
    the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    configuration file /usr/local/nginx/conf/nginx.conf test is successful
    /root/lnmp: line 67: kill: (2955) - No such process
    Nginx program is reloding!
    Shutting down MySQL. [ OK ]
    Starting MySQL. [ OK ]
    Shutting down php_fpm . done
    Starting php_fpm done

    Licess出现这个问题是什么原因

    licess Reply:

    @zcc, 没有错误,/root/lnmp: line 67: kill: (2955) - No such process 显示的是之前没有运行那个程序。

  12. 在的VPS服务器环境是用lnmp0.5搭建的,所有的网站程序都放在/home/wwwroot/下,其中有一个WP博客放在/home/wwwroot/tpimage下。
    我在VPS上用命令安装虚拟主机时,已天际wordpress.conf,但是当我的博客安装好后,我进入后台设置固定链接时,却多了一个index.php,例如/index.php/%year%/%monthnum%/%postname%/ ,我想把这个/index.php去掉,我尝试了许多方法都没有解决问题,是路径设置问题吗?还是其它?

    问题补充:
    我的WP博客放在home/wwwroot/tpimage下,其中这个网站的conf是

    server

    {

    listen 80;

    server_name http://www.tpimage.net;

    index index.html index.htm index.php default.html default.htm default.php;

    root /home/wwwroot/tpimage;

    include /wordpress.conf;

    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;

    }

    另外wordpress.conf是

    location / {

    if (-f $request_filename/index.html){

    rewrite (.*) $1/index.html break;

    }

    if (-f $request_filename/index.php){

    rewrite (.*) $1/index.php;

    }

    if (!-f $request_filename){

    rewrite (.*) /index.php;

    }

    }

    licess Reply:

    @huage.org, include /wordpress.conf; 多了一个斜杠,去掉重启就像了。

  13. 给你的LNMP一键安装包的,关于debian上安装脚本提个改进的建议。
    今天在本地的虚拟机测试了一下,发现安装过程中有问题,最后检查发现,是apt-get源的问题,所以我给的建议是:
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    echo "deb http://http.us.debian.org/debian/ stable main" >> /etc/apt/sources.list
    apt-get update
    apt-get remove -y apache2 apache2-doc apache2-utils apache2.2-common mysql-client mysql-server php
    和这下面的
    apt-get install -y apt-spy
    apt-spy -d stable -a $area -t 5
    cp /etc/apt/sources.list.d/apt-spy.list /etc/apt/sources.list
    apt-spy update
    这样我觉得更好点,不对之处,还请见谅!

  14. 速度真快啊。dia的真好

  15. 军哥好,终于发现整合了ftp,上次我用lnmp的时候因为没有ftp,害的我好惨,只好用了挨冻网的fnmp。现在看到整合了ftp,急忙下了去,但发现还要联网升级。因为我是在一个巨型内部网中使用,由于保密问题,坚决不允许连接互联网,没办法,只好在这里给您提个建议,看能否发布一个整合好所有依赖软件的完全版?这样就不需要在连接互联网进行升级了。我们在安装服务器的时候也可以进行最小化安装,以减少其他不必要的软件,为服务器减负。

  16. lnmp應該要更新一下了,nginx的版本太低了,還有就是在ubuntu上安裝我沒有成功過的。

  17. 主要是安装好像成功了,但是
    mysql dir: /usr/local/mysql
    php dir: /usr/local/php
    没有这两个文件夹!!

    代码如下:

    ===========================phpMyAdmin install completed=================================
    ============================add nginx and php-fpm on startup============================
    ===========================add nginx and php-fpm on startup completed====================
    ===================================== Check install ===================================
    /usr/local/nginx [found]
    Error: /usr/local/php not found!!!
    Error: /usr/local/mysql not found!!!
    ========================== Check install ================================
    Install lnmp 0.5 completed! enjoy it.
    =========================================================================
    LNMP V0.5 for CentOS/RadHat Linux VPS Written by Licess
    =========================================================================

    For more information please visit http://www.lnmp.org/

    lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}
    default mysql root password:19800211
    phpinfo : http://192.168.37.128/phpinfo.php
    phpMyAdmin : http://192.168.37.128/phpmyadmin/
    Prober : http://192.168.37.128/p.php
    Add VirtualHost : /root/vhost.sh

    The path of some dirs:
    mysql dir: /usr/local/mysql
    php dir: /usr/local/php
    nginx dir: /usr/local/nginx
    web dir : /home/wwwroot

    =========================================================================
    =========================================================================
    Manager for LNMP V0.5 , Written by Licess
    =========================================================================
    LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
    This script is a tool to Manage status of lnmp
    For more information please visit http://www.lnmp.org

    Usage: /root/lnmp {start|stop|reload|restart|kill|status}
    =========================================================================
    Nginx is runing!
    /root/lnmp: line 88: /etc/init.d/mysql: No such file or directory
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
    tcp 0 0 :::22 :::* LISTEN

    licess Reply:

    @502 Bad Gateway错误请教, php、mysql都没有安装成功,到http://bbs.vpser.net/forum-25-1.html 提交一下错误日志看看

  18. 博主你好:在lnmp安装后会出现两个账户,www和mysql,想问下两个用户有没有远程登录操作的权限,默认密码是多少,是否需要修改两个账户的密码,将网站目录chown全归为www用户的安全性如何?

  19. 最近怎么安装lnmp0.5老出错?
    我在photonvps和vpsyou的每个系统的试了一下。
    发现最后都是
    Nginx is stop!
    /root/lnmp: line 88: /etc/init.d/mysql: No such file or directory
    Active Internet connections (only servers)
    的错误。郁闷。

    licess Reply:

    @云仙小筑, 安装是执行./centos.sh | tee lnmp.log 把lnmp.log 这个文件上传到bbs.vpser.net,并注明你的环境相关信息。

  20. 我用lnmp安装drupal,结果提示不支持简洁链接。我改如何修改Nginx配置文件。
    Nginx刚入门,求助。

    licess Reply:

    @云仙小筑, /usr/local/nginx/conf/nginx.conf或者vhost/域名.conf include 伪静态.conf;

  21. 求助,在 swap 为0,基础内存128,burst内存256的vps上面安装,出现 ERROR: Cannot allocate memory。

    licess Reply:

    @小邪, 内存不够用了。

  22. 我来留言啦

  23. 请问最近会计划把LNMP一键安装的NginX的版本升到Nginx 0.8.46版本吗?
    我看张宴的测试里说Nginx 0.8.46已经很稳定了。

    licess Reply:

    @Ronald, 不急还是等官网的stable吧。

  24. 安装完nmp0.4-full/

    http://www.lnmp.org/phpinfo.php

    打不开

    显示内容为
    No input file specified.

    licess Reply:

    @文广, 你访问错了,你访问到我这边了。肯定没有这个文件。
    用http://你的ip/phpinfo.php

  25. 你好我按照你的方法试验了,每个虚拟机的server_name都去掉www,访问的时候不加www,域名能自动补全,但是所有虚拟主机访问的还是第一个虚拟主机的内容,请再帮我看看

  26. 那请问下我的这个tomcat的虚拟主机配置有什么问题呢,nginx语法也正确,但是就是无法把jsp请求转给tomcat.麻烦再我看看吧

  27. 博主您好:
    我想请问下几个关于 nginx的问题:
    1.关于虚拟主机的问题,我配置好虚拟主机以后,我访问所有的虚拟主机比如:www.abc.net和www.abc.com,都是正常的,但是如果我访问格式是“abc.net”的话(不加www)是访问的我的配置文件里的第一个虚拟主机,请问这个情况如何解决?
    2.我配置了我的nginx和tomcat,tomcat启动也正常,但是就是无法把我的jsp请求 转给tomcat处理
    附上我的配置文件,请帮我看下问题在什么地方,谢谢!

    user www www;

    worker_processes 1;

    error_log /home/wwwroot/logs/nginx_error.log crit;

    pid /usr/local/nginx/logs/nginx.pid;

    #Specifies the value for maximum file descriptors that can be opened by this process.
    worker_rlimit_nofile 51200;

    events
    {
    use epoll;
    worker_connections 51200;
    }

    http
    {
    include mime.types;
    default_type application/octet-stream;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 8m;

    sendfile on;
    tcp_nopush on;

    keepalive_timeout 60;

    tcp_nodelay on;

    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;

    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    #limit_zone crawler $binary_remote_addr 10m;

    server
    {
    listen 80;
    server_name http://www.abc.com;
    index index.html index.htm index.php;
    root /home/wwwroot/abc;

    location ~ .*\.(php|php5)?$
    {
    fastcgi_pass unix:/tmp/php-cgi.sock;
    # fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }

    location /status {
    stub_status on;
    access_log off;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    }

    location ~ .*\.(js|:css)?$
    {
    expires 12h;
    }

    log_format access '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" $http_x_forwarded_for';
    access_log /home/wwwroot/logs/access.log access;
    }
    #include vhost/*.conf

    #haoyuesao server
    server
    {
    listen 80;
    server_name http://www.abc.net;
    index index.html index.htm index.php;
    root /home/wwwroot/www.abc.net;

    location ~ .*\.(php|php5)?$
    {
    fastcgi_pass unix:/tmp/php-cgi.sock;
    # fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }

    log_format wwwlogs '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" $http_x_forwarded_for';
    access_log /home/wwwroot/logs/wwwlogs.log wwwlogs;
    }

    #happyan server

    server
    {
    listen 80;
    server_name http://www.123.com;
    index index.html index.htm index.php;
    root /home/wwwroot/123;

    location ~ .*\.(php|php5)?$
    {
    fastcgi_pass unix:/tmp/php-cgi.sock;
    # fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }

    log_format anlogs '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" $http_x_forwarded_for';
    access_log /home/wwwroot/logs/anlogs.log anlogs;
    }

    # HTTPS server

    server {
    listen 443;
    server_name http://www.abc.com;
    index index.html index.htm index.php;
    root /phpmyadmin;

    ssl on;
    ssl_certificate /cert/abc.crt;
    ssl_certificate_key /cert/abc_nopass.key;

    ssl_session_timeout 5m;

    ssl_protocols SSLv2 SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;

    location ~ .*\.(php|php5)?$
    {
    fastcgi_pass unix:/tmp/php-cgi.sock;
    # fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    fastcgi_param HTTPS on;
    }

    }

    upstream tomcat_server {
    server 127.0.0.1:8080;
    }

    server
    {
    listen 80;
    server_name http://www.abc.info;
    index index.html index.htm index.jsp default.jsp index.do default.do;
    root /home/wwwroot/sanwei;
    if (-d $request_filename)
    {
    rewrite ^/(.*)([^/])$ http://$host/$1$2 permanent;
    }
    location ~ \.(jsp|jspx|do)?$ {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-FOR $remote_addr;
    proxy_pass http://tomcat_server;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    }
    location ~ .*\.(js|css)?$
    {
    expires 1h;
    }
    access_log off;
    }
    }

    licess Reply:

    @关于nginx的问题, 你没有在虚拟主机server_name 后面加上不带www的域名。

  28. 安装lnmp0.4后,安装 pureftpd 创建的用户无法验证密码,可否帮忙解决一下呢? 谢谢了

    可以联系下我么?

    QQ1131332330
    email mscn@vip.qq.com

    licess Reply:

    @兔子, 查一下/usr/local/pureftp/pureftpd-mysql.conf 文件中mysql配置的参数与/home/wwwroot/ftp/config.php 一致。

  29. 有人给我个国外空间好的网站么

    licess Reply:

    @黄梅网盟, 虚拟主机的话不好推荐,vps的话推荐你用 http://vps.im/tj 或者http://www.vpser.net/usa-vps

  30. 请问lnmp支持Centos 64 bit版本么?似乎没有具体说明,请指教!谢谢

  31. 你好,我刚刚接触VPS。能叫我如何配置吗?只懂得弄虚拟主机。。。。

  32. 您好: 我购买了台美国的VPS 我在系统安装了 nginx 环境,可是操作起来很不方便,要通过命令来建站..不知道 目前有没有控制面板 能否支持 nginx 环境的啊? 如果有的话 麻烦老大介绍介绍啊...
    我想用来搭建主机..

    licess Reply:

    目前没有控制面板支持Nginx。

  33. 别生气了,我知道错了。。。

  34. 你好,我在linode.com买了个VPS。再用本站的一建安装包,但是发现使用使用静态时文章全部出现404页面,我在另一个VPS使用没有出现这种情况,我也看过你发表的http://blog.licess.org/lnmp-0-3-wordpress-rewrite/这个文章,但是我再在以经改好不用再改,请问我是什么地方出错了呢?我的是Debian系统,用的是http://blog.licess.cn/lnmp-debian-ubuntu/这个安装包。请指教,谢谢了

    licess Reply:

    @潜水偷师, 在虚拟主机里面加上include wordpress.conf; 重启kill -HUP `cat /usr/local/nginx/logs/nginx.pid`即可.

  35. 你好,我的VPS 内存只有128M ,目前在上面跑了两个网站,经常出现 504,
    我的nginx 配置文件里应该如何对他作优化呢?
    谢谢。

  36. 安装命令里面有一个地方需要该一下,我用的是centos5.4版本,所以用的是centos.sh的命令,在添加用户和组的时候都出现失败,仔细查看了一下,问题出在:
    groupadd mysql
    useradd -g mysql mysql
    groupadd www
    useradd -g www www

    应改为:

    /usr/sbin/groupadd mysql
    /usr/sbin/useradd -g mysql mysql
    /usr/sbin/groupadd www
    /usr/sbin/useradd -g www www

  37. http://wap.licess.cn/ 用电脑打开,发现直接暴了路径,呵呵!

    Warning: require_once(/web/www/licess/blog/wp-config.php) [function.require-once]: failed to open stream: No such file or directory in /home/wwwroot/licess/blog/wap/wap-config.php on line 10

    Fatal error: require_once() [function.require]: Failed opening required '/web/www/licess/blog/wp-config.php' (include_path='.:') in /home/wwwroot/licess/blog/wap/wap-config.php on line 10

    licess Reply:

    嘻嘻,已更正

  38. 我一不小心用了 killall -HUP nginx 这个命令 导致 访问页面的时候出现

    500 Internal Server Error

    --------------------------------------------------------------------------------

    nginx/0.7.63

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

    也不行。 请问如何处理 ?

    我也试过reboot 服务器 但还是出现这个问题

  39. 嗯,很不错。。支持哦

  40. 怎么集成个最新版的nginx0.8.30+php运行环境啊?能说一下吗,非常感谢。

  41. 你好,在使用咱们的程序的时候发现这个CMS不能安装,CMS的地址是www.arlicle.com

    licess Reply:

    @wujifeng, 不是不能安装,是因为在安装的时候他们使用了伪静态,因为你没有添加伪静态规则,所以无法安装。

  42. 可以集成个最新版的nginx0.8.30+php运行环境吗??谢谢!!!

    licess Reply:

    @avnv, 不推荐使用新版本,比较服务器追求的是稳定,最新的并不一定最适合生产环境。

  43. nginx 怎么打开 ASP 如果可以 一起开2个 1个PHP 1个ASP 应该可以 吧

    目录打开 INDEX.ASP 能显示 不能运转 显示405 Not Allowed

    licess Reply:

    @cainiao, Nginx是不支持ASP的,肯定不能正常运行了

  44. 有关ngnix /blog/的rewrite我找到解决办法了,就是加下面代码:
    location /blog/ {
    if (!-e $request_filename) {
    rewrite ^(.+)$ /blog/index.php?q=$1 last;
    }
    }

    但是我又有新问题想请交老大就是 /blog/目录能不能有通配符代替,难道我每添加一个二级域名就必须多加一个上面的命令吗?有没有一个简单的方法不必为每个目录都添加一次上面的命令?

    谢谢

  45. 看来升级Windows版 wnmp是不可能的啦,遗憾.还是另找算了

  46. 我想请问一下,我在 web/www根目录安装了一个wordpress博客,访问地址是http://mydomain.com,然后又在web/www/blog想安装一个新博客,访问地址是http://mydomain.com/blog,两个博客都在后台设置了永久链接,而且我也按网上的教程设置了nginx的配置使其支持永久链接。现在的问题是主博客能够正常访问,二级博客只能访问主页,进入文章页都是404错误。我想应该是nginx的rewrite规则有点问题:
    location / {
    index index.html index.php;
    if (-f $request_filename/index.html){
    rewrite (.*) $1/index.html break;
    }
    if (-f $request_filename/index.php){
    rewrite (.*) $1/index.php;
    }
    if (!-f $request_filename){
    rewrite (.*) /index.php;
    }
    }
    我这种情况正确的rewrite规则应该是什么呢?盼解答,万分感谢。

    licess Reply:

    @willy, 你再加上下面这一段试试,应该就好了
    location /blog {
    index index.html index.php;
    if (-f $request_filename/index.html){
    rewrite (.*) $1/index.html break;
    }
    if (-f $request_filename/index.php){
    rewrite (.*) $1/index.php;
    }
    if (!-f $request_filename){
    rewrite (.*) /index.php;
    }
    }

  47. Nginx官方推出了Windows版 ,能不能升级WNMP,顺便升级一下其他组件,盼
    老大老大我快疯狂了,老大更新吧,我为你快疯狂了

    licess Reply:

    @现在好多都升级了,能不能把wnmp升一下级,
    俺现在基本上不用Windows了,还是换成Linux吧。。。性能很强的

  48. 还有就是我的主机是独立主机,不需要在上面再挂其他网站,您教程中的以下代码还用不用参照来改动我的主机配置文件?

    添加虚拟主机:

    修改/usr/local/nginx/conf/nginx.conf 文件

    server
    {
    listen 80;
    server_name status.lnmp.org;

    location / {
    stub_status on;
    access_log off;
    }
    }

    后面添加上下面代码:

    server
    {
    listen 80;
    server_name http://www.lnmp.org;
    index index.html index.htm index.php;
    root /web/www/abc;

    location ~ .*\.(php|php5)?$
    {
    fastcgi_pass unix:/tmp/php-cgi.sock;
    #fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 30d;
    }

    location ~ .*\.(js|css)?$
    {
    expires 12h;
    }

    access_log off;
    }

    再执行kill -HUP `cat /usr/local/nginx/logs/nginx.pid`虚拟机就生效了。

  49. 您好,如果按照您的分区方案做了系统,那么在安装LNMP以后,以下软件安装目录还有没有改变???
    程序安装路径:
    MySQL : /usr/local/mysql
    PHP : /usr/local/php
    Nginx : /usr/local/nginx
    PHPMyAdmin /web/www/phpmyadmin
    Web目录 /web/www

    还有就是我看了/web/www目录,发现里面还有除了phpmyadmin以外还有一个文件,如果把网页直接/web/www目录下,因为phpmyadmin的存在,我总感觉有点不太安全,我想在/web/www目录下再建一个比如html目录来放网页,但不知道,如果输入我的域名http://www.610324.net后,能否访问到我网页?换句话说,如果能访问到网页的话,域名是http://www.610324.net呢?还是http://www.610324.net/html/index.php 呢?如果访问不到,应该在什么地方修改什么文件、怎么修改才能正确打开网页?

  50. 我在您的“LNMP-Linux下Nginx+PHP+MySQL+phpMyAdmin+eAcelerator一键安装包”文章后面留言,当时看已经留言成功,为什么刷新一下就没有了呢?

    我的意思是想请您提出一个CentOS5.3下使用“LNMP-Linux下Nginx+PHP+MySQL+phpMyAdmin+eAcelerator一键安装包”搭建web环境的最佳分区方案好吗?

    licess Reply:

    @向光明, 呵呵,刚写了篇文章,看一下吧:Linux Web服务器分区方案

  51. Nginx官方推出了Windows版 ,能不能升级WNMP,顺便升级一下其他组件,盼

  52. php-cgi会无故消失,在WINDOWS环境下。

  53. 现在你有瑞豪开源的优惠码吗 目前 7折的到期了

    ps 下载系统给分源码怎样?

  54. Nginx官方推出了Windows版 ,能不能升级WNMP,顺便升级一下其他组件,菜鸟盼

  55. win2003安装LNMP后
    1、如何填加多个网站?绑定域名?
    2、用于托管情况下,基本上可稳定?
    3、直接支持asp吗?
    谢谢!

    licess Reply:

    @请教了,
    LNMP是运行在Linux平台下的,wnmp可以运行在Windows2003下
    1、修改nginx.conf 里面的sercer{}。一个sercer{}就是一个虚拟主机
    2、Nginx比较稳定,而且使用内存少
    3、不支持ASP,但是可以用proxy转向到本机的IIS上(如果你用Windows,安装IIS,需修改端口)

  56. @问下:我想在单位内网建一个站不知nginx可用生产环境不?, Nginx现在已经被很多站长选用,我的VPS、公司的服务器都是用的Nginx,Nginx做生产环境很合适的,很多门户也用Nginx。

  57. 我想在单位内网建一个站不知nginx可用生产环境不?

  58. 请问这个LNMP安装默认装了rewrite没
    我配置了简单的rewrite规则始终不成功啊

  59. 学习一下,有空会多来看看

  60. 请教一个问题,在windows xp 系统上操作php 和mysql 数据库,把opt文件放到e盘的根目录下,并启动了start,但在进程里没有nginx进程,在ie浏览器内输入http://localhost:8080回车显示的是Apche Tomcat/5.028
    而不是nginx界面,在ie浏览器内输入http://localhost:8080/phpmyadmin/index.php 无法显示网页
    请问这是怎么回事,要怎么解决,谢谢!

    licess Reply:

    @gaocuiyao, 不是访问8080端口,而是80端口,访问phpmyadmin:http://localhost/phpmyadmin/ 即可。

  61. 请教个问题:怎么配置2个以上的网站呢?难道nginx只支持2个网站?当配置2个的时候启动没问题,3个就会看不了。

    例如:server {
    listen 80;
    server_name http://www.xxx1.com;
    index index.html index.htm index.php;
    root /www/data1;
    access_log off;
    }
    server {
    listen 80;
    server_name http://www.xxx2.com;
    index index.html index.htm index.php;
    root /www/data2;
    access_log off;
    }
    server {
    listen 80;
    server_name http://www.xxx3.com;
    index index.html index.htm index.php;
    root /www/data3;
    access_log off;
    }
    这样的话就启动不了,难道只支持2个?

    谢谢指教

  62. 呵呵,测试一下留言,分享Linux :http://www.xlinux.org/

发表留言