歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

centos中快速搭建Magento&Makingware Nginx主機環境


centos中快速搭建Magento&Makingware Nginx主機環境   本文主要使用yum方式安裝適應magento運行的LNMP主機環境。 *適用於純淨版Centos, 如果有httpd之類的進程請先停止httpd。 本文安裝完後為 nginx/1.2.2 Mysql5.5 PHP5.3.14 APC 3.1.9   導入外部軟件庫 請選擇對應的centos版本,別錯了哦 不確定版本及32還是64可以使用一下命令檢查 more /etc/redhat-release (查看centos版本) uname -r(查看內核位數)   centos-5 32位: 1 rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm 2 rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-10.ius.el5.noarch.rpm 3  www.2cto.com   rpm -Uvh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm   centos-5 64位: 1 rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/epel-release-5-4.noarch.rpm 2 rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm 3 rpm -Uvh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm   www.2cto.com   centos 6 在下面尋找對應的包 使用  rpm -Uvh xxx 提示沖突可使用   rpm -e 對應的沖突包 軟件庫:http://dl.iuscommunity.org/pub/ius/stable/Redhat/ Nginx : http://nginx.org/packages/centos/   vi /etc/yum.repos.d/ius.repo,以下行注釋: 1 mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el5&arch=$basearch 以下行刪除注釋: 1 #baseurl=http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/$basearch   更新yum 1 yum -y update 使用yum安裝所需要的程序/庫 1 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers   www.2cto.com   安裝php相關插件 1 yum install php53u-gd php53u-xml php53u-mysql php53u-mcrypt php53u-mbstring php53u-pear pcre-devel php53u-devel   pecl方式安裝apc 1 pecl install apc   添加apc擴展到php中 vim /etc/php.d/apc.ini 下面代碼僅供參考根據具體配置來修改 01 extension = apc.so 02 [apc] 03 apc.enabled = 1 04 apc.shm_size = 256M 05 apc.ttl = 7200 06  www.2cto.com   apc.user_ttl  = 7200 07 apc.num_files_hint = 10240 08 apc.max_file_size = 128M 09 apc.stat = 0 10 apc.include_once_override = 1   配置nginx vi /etc/nginx/conf.d/default.conf 也可以在 /etc/nginx/conf.d/目錄下面新建.conf文件 參考( 適合magento 的配置文件)其他系統可參考:) 01 server { 02     listen       80; 03     server_name  demo.makingware.com;#你的域名 04  www.2cto.com     05     root  /var/www/demo.makingware.com;#你的目錄 06     index index.php index.html index.htm; 07     location / { 08     if (-f $request_filename) { 09       expires 30d; 10       break; 11     } 12     if (!-e $request_filename) { 13       rewrite ^(.+)$ /index.php last; 14     } 15   } 16   location ~ \.php$ { 17   18     include       fastcgi_params; 19     fastcgi_pass  127.0.0.1:9000; 20     fastcgi_index index.php; 21     fastcgi_param SCRIPT_NAME $fastcgi_script_name; 22     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 23  www.2cto.com     } 24   location /app/etc { 25     deny all; 26   } 27 }   啟動lnmp chkconfig php-fpm on chkconfig nginx on chkconfig mysqld on service php-fpm start service nginx start service mysqld start   進入網站目錄 修改用戶權限 1 chown -R apache:apache * php-fpm默認用戶名及用戶組是apache 修改默認用戶組 vi /etc/php-fpm.d/www.conf   www.2cto.com   修改mysql root 密碼 mysqladmin -u root -p password 你的密碼   使用ssh方式鏈接 Mysql如果出現 密碼錯誤使用下面辦法解決 vim /etc/my.cnf 注釋 #skip-name-resolve service mysqld restart   *nginx中修改php配置後使用 service php-fpm restart更新修改     作者 哥哥
Copyright © Linux教程網 All Rights Reserved