nginx,apache,mysql,php=namp配置始末
一直使用的appserv的集成环境,其整合的amp其实版本都比较低了
也想试试nginx做前端,转发php到apache上的搭配。 所以决定单独下载最新的amp加上nginx形成 namp,编写bat脚本启停各个软件 1、下载各软件的windows下非安装版本 httpd 下载的是这个网站的编译版本,和php的VC11对应,开始时因为这个编译版本的问题怎么也整不进来,apache官网没有该编译版本 php : php-5.5.3-Win32-VC11-x86.zip,线程安全版本的,官网 mysql:mysql-5.5.33-win32 官网 nginx:nginx-1.5.4 官网 2、解压到namp文件夹,文件夹命名为不带版本号的,方便以后单独升级 3、编写各软件的配置文件,我配的有: httpd.conf,# Add to the end of the LoadModule sectionLoadModule php5_module php5apache2_4.dllPHPIniDir "D:/namp/php/"AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php .php5 # Virtual hostsInclude conf/extra/httpd-vhosts.conf
httpd-vhosts.conf
Listen 8878ServerAdmin webmaster@host8878.qingfeng.com DocumentRoot "D:/namp/data/www/host8878" ServerName host8878.qingfeng.com ServerAlias www.host8878.qingfeng.com ErrorLog "D:/namp/data/logs/apache/host8878-error.log" CustomLog "D:/namp/data/logs/apache/host8878-access.log" common Listen 8879Options Indexes FollowSymLinks AllowOverride ALL Order allow,deny Allow from all ServerAdmin webmaster@host8879.qingfeng.com DocumentRoot "D:/namp/data/www/host8879" ServerName host8879.qingfeng.com ServerAlias www.host8879.qingfeng.com ErrorLog "D:/namp/data/logs/apache/host8879-error.log" CustomLog "D:/namp/data/logs/apache/host8879-access.log" common Options Indexes FollowSymLinks AllowOverride ALL Order allow,deny Allow from all
php.ini,
date.timezone = UTCsession.save_path = "D:/namp/data/logs/sessions" extension_dir = "D:/namp/php/ext/"
my.ini,
basedir="D:/namp/mysql"#Path to the database rootdatadir="D:/namp/data/db/data"# The default character set that will be used when a new schema or table is# created and no character set is definedcharacter-set-server=utf8 collation-server =utf8_general_ciinit_connect ='SET collation_connection = utf8_general_ci'init_connect ='SET NAMES utf8'# The default storage engine that will be used when create new tables whendefault-storage-engine=INNODB#*** INNODB Specific options ***innodb_data_home_dir="D:/namp/data/db/innodb_datadir"general-log=on long_query_time = 2log-queries-not-using-indexesslow-query-log=onslow-query-log-file="D:/namp/data/logs/mysql/mysql-slow.log"log-error="D:/namp/data/logs/mysql/mysql_error.log"
nginx.conf(附件) 配置里面都是用的绝对全路径,我把namp放在D盘,动态数据放在data目录。结构如图: