【SQL开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。
网学会员整理了SQL开源代码-Ubuntu Server+Nginx+Mysql+Php5.3+Zend Guard Loader+eAccelerator+ ... - 企业软件开发的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
本文来源:http://forum.ubuntu.org.cn/viewtopic.phpt241301作者博客:http://hi.baidu.com/zhcj感谢 Ubuntu 中文论坛的:黄大少 、 2xy、Jarson 、neowing、 yuxiao、Helleon、ikcihc、skywing 。
本文更新时间:2011 年 1 月 20 日Ubuntu ServerNginxMysqlPhp5.3Zend Guard LoadereAcceleratorPhpMyAdmin 安装配置详解把我架设 lnmp 网站的过程写出来,希望对想架设网站的朋友有所帮助,如有更好的办法请提出来。
之所以用 nginx 没用 apache,是因为 nginx 的效率更高一些,尤其是对一些低配置的服务器,比如我在单位 256M 内存的旧机器上架设的服务器。
1、安装 ubuntu server 10.04 或 10.10,其中安装语言选 en,时区 shanghai,服务只安装 ssh,其他全部用默认就行。
提示:以上安装过程完成后,建议用其他计算机登录服务器,windows 系统可以用 putty,linux 系统直接在终端用命令就可以:
代码:ssh 登录名服务器 ip因为以下过程得输入大量命令和
代码,在客户机上直接粘贴即可(在 windows 下的 putty 中单击右键即可把剪贴板中的内容粘贴到终端)。
2、添加源:
代码:sudo vi /etc/apt/sources.listlucid10.04的源添加如下:
代码:deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiversedeb http://ppa.launchpad.net/nginx/stable/ubuntu lucid mainmaverick10.10的源:
代码:deb http://archive.ubuntu.com/ubuntu/ maverick main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ maverick-security main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiversedeb http://archive.ubuntu.com/ubuntu/ maverick-backports main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ maverick main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ maverick-security main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiversedeb-src http://archive.ubuntu.com/ubuntu/ maverick-backports main restricted universe multiversedeb http://ppa.launchpad.net/nginx/stable/ubuntu maverick main最后一行为 nginx 的 ppa 源,需要添加 key,在终端运行:
代码:sudo apt-key adv --keyserver keyserver.Ubuntu.com --recv-keys C300EE8C3、更新
代码:sudo apt-get update4、安装网站系统
代码:sudo apt-get install nginx php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pearphp5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl mysql-server上面为必选安装,以下 php 组件为可选安装,一般网站程序可能用不着:
代码:sudo apt-get install php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin php5-odbcphp5-ladp5、修改 nginx 配置文件
代码:sudo vi /etc/nginx/sites-enabled/default把其中的:
代码: location / root /var/www index index.html index.htm 改为:
代码: location / root /var/www/nginx-default index index.php index.html index.htm 其中的:
代码: location .php fastcgi_pass 127.0.0.1:9000 fastcgi_index index.php include fastcgi_params 改为:
代码: location .php fastcgi_pass 127.0.0.1:9000 fastcgi_index index.php fastcgi_param SCRIPT_FILENAME /var/www/nginx-defaultfastcgi_script_name include fastcgi_params 6、更改网站目录权属:
代码:sudo chown -R ubuntu nginx-default/注:其中的 ubuntu 为系统登录用户名。
7、安装 ZendGuardLoader 及 eaccelerator:
代码:sudo mkdir /usr/zendmkdir /tmp/eacceleratorchmod 0777 /tmp/eacceleratorwget http://phpcj.googlecode.com/files/ZendGuardLoader.sosudo mv ZendGuardLoader.so /usr/zend/ZendGuardLoader.sowget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2tar xvjf eaccelerator-0.9.6.1.tar.bz2cd eaccelerator-0.9.6.1cp control.php /var/www/nginx-default/control.php //复制控制程序到网站目录,通过 http://网站名/control.php 访问,默认帐号为admin,密码为 eAccelertor,可编辑此文件修改。
phpizesudo ./configure --enable-eacceleratorsharedsudo makesudo make installsudo vi /etc/php5/fpm/php.ini在配置文件最后加上:
代码:zend_extension/usr/zend/ZendGuardLoader.sozend_loader.enable1zend_loader.disable_licensing0zend_loader.obfuscation_level_support3zend_loader.license_pathzend_extension/usr/lib/php5/20090626lfs/eaccelerator.soeaccelerator.shm_size16eaccelerator.cache_dir/tmp/eacceleratoreaccelerator.enable1eaccelerator.optimizer1eaccelerator.check_mtime1eaccelerator.debug0eaccelerator.filtereaccelerator.shm_max0eaccelerator.shm_ttl0eaccelerator.shm_prune_period0eaccelerator.shm_only0eaccelerator.compress1eaccelerator.compress_level9eaccelerator.allowed_admin_path/var/www/nginx-default/control.php8、(可选步骤)安装 phpmyadmin:
代码:wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.9/phpMyAdmin-3.3.9-all-languages.tar.bz2tar xvjf phpMyAdmin-3.3.9-all-languages.tar.bz2mv phpMyAdmin-3.3.9-all-languages /var/www/nginx-default/phpmyadmincd /var/www/nginx-default/phpmyadmincp config.sample.inc.php config.inc.phpvi config.inc.php将其中的:
代码:cfgblowfish_secret 改为:
代码:cfgblowfish_secret web下面的:
代码:// cfgServersicontroluser pma// cfgServersicontrolpass pmapass// cfgServersipmadb phpmyadmin// cfgServersibookmarktable pma_bookmark// cfgServersirelation pma_relation// cfgServersitable_info pma_table_info// cfgServersitable_coords pma_table_coords// cfgServersipdf_pages pma_pdf_pages// cfgServersicolumn_info pma_column_info// cfgServersihistory pma_history// cfgServersitracking pma_tracking// cfgServersidesigner_coords pma_designer_coords// cfgServersiauth_swekey_config /etc/swekey-pma.conf将//全部删除,然后将其中的:
代码:cfgServersicontroluser pmacfgServersicontrolpass pmapasspma 和 pmapass 改为你的 mysql 用户名和密码, 将 最后登录 phpmyadmin, phpmyadmin/scripts 目录中的 creat_tables.
sql 文件导入 mysql。
9、重启系统、上传文件,网站建立成功!试试吧!文件上传建议用 filezilla(http://filezilla-project.org/) ,免费的
开源 ftp 软件,windows 和 linux 都可以用,支持 ssh 的 22 端口。
附:系统及部分软件管理操作1、操作系统:
代码:sudo reboot now //重启系统sudo halt //关闭系统2、nginx 配置修改及生效:
代码:sudo vi /etc/nginx/nginx.conf //修改配置sudo vi /etc/nginx/sites-enabled/default //修改配置sudo service nginx restart //重启 nginx3、php 配置修改及生效:
代码:sudo vi /etc/php5/fpm/php.ini //修改配置sudo service php5-fpm restart //重启 fastcgi 进程3、网站目录:
代码:/var/www/nginx-default4、eaccelerator 管理:
代码:http://你的网站/control.php5、修复 nginx+php 出现的重大漏洞、修改上传文件大小(可以看你自己的情况)
代码:sudo vi /etc/php5/fpm/php.inicgi.fix_pathinfo 0 //修复漏洞upload_max_filesize 2M 改为 5M //修改上传文件大小6、设定防火墙
代码:sudo ufw enablesudo ufw default denysudo ufw allow 80sudo ufw allow 227、启动 php5-fpm 时,出现:
代码:PHP Deprecated: Comments starting with are deprecated in /etc/php5/fpm/conf.d/ming.ini on line 1 in Unknown on line0WARNING pool www pm.start_servers is not set. Its been set to 20.的提示,第一行的原因是在配置文件中已用代替来进行注释。
修改以下文件:
代码:vi /etc/php5/fpm/conf.d/ming.ini将改为即可。
第二行原因是/etc/php5/fpm/pool.d/www.conf 配置文件中的
代码:pm.start_servers 20去掉前面的即可。
8、Discuz7.2 后台启动 URL 静态化,会提示 404 Not Found 的解决办法:在 niginx 中开启 Rewrite在服务器配置文件 nignx.conf 中写入以下内容,然后重启 nginx。
代码:rewrite /archiver/fidtid-w-.html /archiver/index.php1 lastrewrite /forum-0-9-0-9.html /forumdisplay.phpfid1page2 lastrewrite /thread-0-9-0-9-0-9.html /viewthread.phptid1extrapage3D3page2 lastrewrite /space-usernameuid-..html /space.php12 lastrewrite /tag-..html /tag.phpname1 lastbreak注意你的论坛地址,如论坛目录为/bbs/,则上面的
代码改为:
代码:rewrite /bbs/archiver/fidtid-w-.html /bbs/archiver/index.php1 lastrewrite /bbs/forum-0-9-0-9.html /bbs/forumdisplay.phpfid1page2 lastrewrite /bbs/thread-0-9-0-9-0-9.html /bbs/viewthread.phptid1extrapage3D3page2 lastrewrite /bbs/space-usernameuid-..html /bbs/space.php12 lastrewrite /bbs/tag-..html /bbs/tag.phpname1 lastbreak
上一篇:
基于开源框架的终端运维管理系统的设计
下一篇:
恋沫