lnmp:测试

© ㄒiger / Posted in 主机域名 / June 19, 2012

无聊贴,记录折腾记录.. ..部分可能有错误,仅供参考

lnmp一键安装包(lnmp.org)

squid 2.6.STABLE21(直接yum install squid 安装)

目的:前端squid 反向代理后端web站点以及反向代理其他外部站点

首先安装好lnmp环境,安装过程参考,http://lnmp.org/install.html 

然后安装squid

yum install squid

然后删除 /etc/squid/squid.conf

rm  /etc/squid/squid.conf

下载squid.conf配置文件 (端口80)

cd /etc/squid/
wget http://tiger.im/soft/squid.conf

假设使用8001端口做后端web访问端口 前端squid使用80端口

vi squid.conf

找到如下:

cache_peer 127.0.0.1  parent 8001 7 no-query originserver name=www1 


cache_peer_domain www1 tiger.im www.tiger.im 

127.0.0.1是反向本机后端web站点 也可以换成其他的 端口8001

cache_peer_domain www1 域名 为后端绑定的域名

如果是多站点反向代理,继续可以添加,

cache_peer 123.123.123.123 parent 8001 7 no-query originserver name=www2

cache_peer 192.168.1.1 parent 8001 7 no-query originserver name=www3

cache_peer_domain www2 ds.tiger.im www.tiger.im

cache_peer_domain www3 test.tiger.im www.tiger.im

修改完毕后,先不着急启动squid..开始修改lnmp的参数

需要修改nginx.conf 

vi /usr/local/nginx/conf/nginx.conf
server
        {
                listen       8001;

 将端口80换成8001

然后修改 vhost.sh 里面的端口为8001

server
        {
                listen       8001;
                server_name $domain$moredomainame;
                index index.html index.htm index.php default.html default.htm default.php;

这样添加域名的时候默认自动端口为8001

重启下lnmp  : 

/root/lnmp restart

启动squid

service squid start

设置开启启动squid

chkconfig --add squid
 chkconfig --level 2345 squid on

ok.....好吧,很罗嗦的写完了.

© ㄒiger / Posted in 主机域名 / March 3, 2012

登录phpmyadmin面板的时候有时候会提示这个:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 22616212 bytes) in Unknown on line 0

修改php.ini 里面的 内存使用

  脚本占用最大内存(memory_limit): 256M

改成大点的。lnmp默认好像128M 可以根据自身机器内存大小调整下

 

© ㄒiger / Posted in 主机域名 / February 1, 2012

Nginx program is reloding!
MySQL PID file could not be found!                         [失败]
Reload service php-fpm  done

Stoping LNMP...
Nginx program is stop
Shutting down php_fpm . done
PHP-FPM program is stop
Shutting down MySQL.Manager of pid-file quit without updati[失败]e.
MySQL program is stop

出现这个后,可以试试单独重启下mysql

/etc/init.d/mysql start

 

就可以了,当然reboot也可以解决。

@ 或者 top 下 看下 mysqld的 pid 编号

然后kill 标号.

接着重启下mysql...  ok

 

[root@pr lnmp0.8-full]# ./lnmp reload
=========================================================================
Manager for LNMP V0.8  ,  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}
=========================================================================
Reload LNMP...
Reload Nginx configure...
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Nginx program is reloding!
MySQL PID file could not be found!                         [失败]
Reload service php-fpm  done
[root@pr lnmp0.8-full]#
[root@pr lnmp0.8-full]#
[root@pr lnmp0.8-full]# vi /etc/my.cnf
[root@pr lnmp0.8-full]# ./lnmp restart
=========================================================================
Manager for LNMP V0.8  ,  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}
=========================================================================
Stoping LNMP...
Nginx program is stop
Shutting down php_fpm . done
PHP-FPM program is stop
MySQL program is not runing!
Starting LNMP...
Nginx start successfully!
Starting php_fpm  done
PHP-FPM start successfully!
Starting MySQL.Manager of pid-file quit without updating fi[失败]
MySQL start successfully!
[root@pr lnmp0.8-full]# ./lnmp restart
=========================================================================
Manager for LNMP V0.8  ,  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}
=========================================================================
Stoping LNMP...
Nginx program is stop
Shutting down php_fpm . done
PHP-FPM program is stop
Shutting down MySQL.Manager of pid-file quit without updati[失败]e.
MySQL program is stop
Starting LNMP...
Nginx start successfully!
Starting php_fpm  done
PHP-FPM start successfully!
MySQL is runing!

© ㄒiger / Posted in 程序代码 / January 7, 2012

lnmp一键安装包(LNMP.ORG)反向代理配置

去掉nginx.conf 最后一个 } 然后添加代码。。

server {
   listen 80;
   server_name www.tiger.im tiger.im;
 location / {
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_pass http://tiger.im;
    proxy_set_header  x-real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    }
 }

修改/etc/hosts 里面添加后端网站IP 

123.123.123.123  tiger.im

123.123.123.123 www.tiger.im

然后去域名管理商解析域名A记录到反向代理的这台机器ip上..

© ㄒiger / Posted in 主机域名 / November 29, 2011

可能是eaccelerator版本的问题吧,编辑eaccelerator.sh文件,将里面的

wget -c http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1/
wget -c http://soft.vpser.net/web/eaccelerator/eaccelerator-0.9.5.3.tar.bz2
tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/

然后重启apache 就OK了

apache.jpg