2019独角兽企业重金招聘Python工程师标准>>>
nginx,apache,mysql,php=namp配置始末
一直使用的appserv的集成环境,其整合的amp其实版本都比较低了
也想试试nginx做前端,转发php到apache上的搭配。
所以决定单独下载最新的amp加上nginx形成 namp,编写bat脚本启停各个软件
1、下载各软件的windows下非安装版本
httpd 下载的是这个网站的编译版本Apache 2.4.6 win32 VC11 update 3,和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 section
LoadModule php5_module php5apache2_4.dll
PHPIniDir "D:/namp/php/"<IfModule mime_module>AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps AddType application/x-httpd-php .php3AddType application/x-httpd-php .php4AddType application/x-httpd-php .php5
</IfModule># Virtual hosts
Include conf/extra/httpd-vhosts.conf
httpd-vhosts.conf
Listen 8878
<VirtualHost *:8878>ServerAdmin webmaster@host8878.qingfeng.comDocumentRoot "D:/namp/data/www/host8878"ServerName host8878.qingfeng.comServerAlias www.host8878.qingfeng.comErrorLog "D:/namp/data/logs/apache/host8878-error.log"CustomLog "D:/namp/data/logs/apache/host8878-access.log" common<Directory "D:/namp/data/www/host8878"> Options Indexes FollowSymLinks AllowOverride ALL Order allow,denyAllow from all </Directory>
</VirtualHost>Listen 8879
<VirtualHost *:8879>ServerAdmin webmaster@host8879.qingfeng.comDocumentRoot "D:/namp/data/www/host8879"ServerName host8879.qingfeng.comServerAlias www.host8879.qingfeng.comErrorLog "D:/namp/data/logs/apache/host8879-error.log"CustomLog "D:/namp/data/logs/apache/host8879-access.log" common<Directory "D:/namp/data/www/host8879"> Options Indexes FollowSymLinks AllowOverride ALL Order allow,denyAllow from all </Directory>
</VirtualHost>
php.ini,
date.timezone = UTC
session.save_path = "D:/namp/data/logs/sessions"extension_dir = "D:/namp/php/ext/"
my.ini,
basedir="D:/namp/mysql"#Path to the database root
datadir="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 defined
character-set-server=utf8
collation-server =utf8_general_ci
init_connect ='SET collation_connection = utf8_general_ci'
init_connect ='SET NAMES utf8'# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
#*** INNODB Specific options ***
innodb_data_home_dir="D:/namp/data/db/innodb_datadir"
general-log=on long_query_time = 2
log-queries-not-using-indexes
slow-query-log=on
slow-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目录。结构如图: