Created
January 3, 2014 21:49
-
-
Save roxlu/8247298 to your computer and use it in GitHub Desktop.
NGINX + PHP on Mac 10.9, WIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Compiling nginx + php + mysql on Mac OSX 10.9 | |
# --------------------------------------------- | |
# | |
# | |
# Configure nginx | |
# --------------- | |
# Add this to the between the server { ... } config: | |
# | |
# -- | |
# location ~ \.php$ { | |
# include fastcgi_params; | |
# fastcgi_index index.php; | |
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
# fastcgi_pass php; | |
# } | |
# -- | |
set -x | |
function check_file { | |
f=${1} | |
from_name=${2} | |
to_name=${3} | |
if [ ! -f ${f} ] ; then | |
echo "Please download $f first into this directory." | |
exit | |
fi | |
if [ ! -d ${to_name} ] ; then | |
tar -zxvf ${f} | |
mv ${from_name} ${to_name} | |
fi | |
} | |
autoconf_file="autoconf-2.69.tar.gz" | |
automake_file="automake-1.14.tar.gz" | |
libtool_file="libtool-2.4.2.tar.gz" | |
nginx_file="nginx-1.5.8.tar.gz" | |
pcre_file="pcre-8.34.tar.gz" | |
ssl_file="openssl-1.0.1e.tar.gz" | |
iconv_file="libiconv-1.14.tar.gz" | |
php_file="php-5.5.7.tar.gz" | |
gettext_file="gettext-0.18.3.1.tar.gz" | |
png_file="libpng-1.6.8.tar.gz" | |
jpg_file="jpegsrc.v9.tar.gz" | |
bd=${PWD} | |
build_dir=${bd}/build/ | |
check_file ${nginx_file} "nginx-1.5.8" "nginx" | |
check_file ${pcre_file} "pcre-8.34" "pcre" | |
check_file ${ssl_file} "openssl-1.0.1e" "ssl" | |
check_file ${automake_file} "automake-1.14" "automake" | |
check_file ${autoconf_file} "autoconf-2.69" "autoconf" | |
check_file ${libtool_file} "libtool-2.4.2" "libtool" | |
check_file ${php_file} "php-5.5.7" "php" | |
check_file ${gettext_file} "gettext-0.18.3.1" "gettext" | |
check_file ${iconv_file} "libiconv-1.14" "iconv" | |
check_file ${png_file} "libpng-1.6.8" "png" | |
check_file ${jpg_file} "jpeg-9" "jpg" | |
export PATH="${build_dir}/bin:${PATH}" | |
export CFLAGS="-I${build_dir}/include/ -m64 -arch x86_64" | |
export CPPFLAGS=${CFLAGS} | |
export CXXFLAGS=${CFLAGS} | |
export LDFLAGS="-L${build_dir}/lib/" | |
# if [ ! -f ${build_dir}/lib/libpcre.a ] ; then | |
# cd ${bd}/pcre | |
# ./configure --prefix=${build_dir} | |
# make | |
# make install | |
# fi | |
# | |
# if [ ! -f ${build_dir}/lib/libssl.a ] ; then | |
# cd ${bd}/ssl | |
# ./config --prefix=${build_dir} | |
# make | |
# make install | |
# fi | |
# | |
# if [ ! -f ${build_dir}/bin/autoconf ] ; then | |
# cd ${bd}/autoconf | |
# ./configure --prefix=${build_dir} | |
# make | |
# make install | |
# fi | |
# | |
# if [ ! -f ${build_dir}/bin/automake ] ; then | |
# cd ${bd}/automake | |
# ./configure --prefix=${build_dir} | |
# make | |
# make install | |
# fi | |
# | |
# if [ ! -f ${build_dir}/bin/libtool ] ; then | |
# cd libtool | |
# ./configure --prefix=${build_dir} | |
# make | |
# make install | |
# fi | |
if [ ! -f ${build_dir}/bin/gettext ] ; then | |
cd gettext | |
./configure --prefix=${build_dir} | |
make | |
make install | |
fi | |
if [ ! -f ${build_dir}/include/iconv.h ] ; then | |
cd iconv | |
./configure --prefix=${build_dir} | |
make | |
make install | |
fi | |
if [ ! -f ${build_dir}/include/png.h ] ; then | |
cd png | |
./configure --prefix=${build_dir} | |
make | |
make install | |
fi | |
if [ ! -f ${build_dir}/include/jpeglib.h ] ; then | |
cd jpg | |
./configure --prefix=${build_dir} | |
make | |
make install | |
fi | |
cd php | |
./configure --prefix=${build_dir} \ | |
--with-iconv=${build_dir} \ | |
--enable-fpm | |
make | |
make install | |
exit | |
cd ${bd}/nginx | |
./configure --prefix=${build_dir} \ | |
--with-pcre=${bd}/pcre \ | |
# --with-openssl=${bd}/ssl \ | |
--with-http_ssl_module \ | |
--with-cc-opt="-m64 -arch x86_64" \ | |
--with-ld-opt="-m64 -arch x86_64" | |
make | |
make install | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment