最近想本地写点程序,要不总是commit代码,效率低…
不喜欢默认安装,那就自己手动安装吧;
#vim ~/.bashrc //追加如下命令
#export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com
报错信息
nginx error: ‘OSAtomicAdd64’ is deprecated: first deprecated in macOS 10.12.
解决办法:
vim objs/Makefile,将:
CFLAGS = -pipe -O -Wall -Wextra -Wpointer-arith -Wno-unused-parameter -Werror -g
这一行去掉-Werror
vim objs/Makefile,搜索到如下行:
3.由于macx10+没有ldconfig命令,所以需要更改编译文件,自行添加路径
#cd /data/install/tengine-2.2.0/
#./configure --prefix=/data/server/nginx --sbin-path=/data/server/nginx/sbin/nginx --conf-path=/data/server/nginx/conf/nginx.conf --error-log-path=/data/server/nginx/log/error.log --http-log-path=/data/server/nginx/log/access.log --pid-path=/data/server/nginx/nginx.pid --lock-path=/data/server/nginx/lock/nginx.lock --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module --with-http_addition_module --with-http_random_index_module --with-http_dav_module --with-openssl=/data/server/src/openssl-1.0.2l --with-pcre=/data/server/src/pcre-8.38 --with-zlib=/data/server/src/zlib-1.2.11
#vim objs/Makefile
#第二行,去掉-Werror
#搜索openssl,将./config --prefix=/data/server/src/openssl-1.0.2l/.openssl no-shared
更换位:./Configure darwin64-x86_64-cc --prefix=/data/server/src/openssl-1.0.2l/.openssl no-shared
#make test
#make
#make install
#/data/server/nginx/sbin/nginx -m
#mkdir /data/server/nginx/ssl
#cd /data/server/nginx/ssl
/**根据提示输入密码和组织信息即可**/
#/usr/local/openssl/bin/openssl genrsa -des3 -out server.key 1024
#/usr/local/openssl/bin/openssl req -new -key server.key -out server.csr
#/usr/local/openssl/bin/openssl rsa -in server.key -out server_nopwd.key
#/usr/local/openssl/bin/openssl x509 -req -days 365 -in server.csr -signkey server_nopwd.key -out server.crt
/**建立80端口所有域名转发**/
#vim vhost_default.conf
#vim vhost_default.conf //参看附件1
#vim vhost_localhost_ssl.conf //参看附件1文件
#nginx -t && nginx -s reload
其他方式坑太他妈多了,数据目录一定要放在自己的非系统环境里,否则丢失了就麻烦了
#brew install mysql
#unset TMPDIR
#mysql_install_db --verbose --user='_mysql' --basedir="$(brew --prefix mysql)" --datadir=/data/server/mysql/data/
#mysql.server start
#brew upgrade openssl
#ls -l /usr/local/openssl/ //查看是否有动态库
libcurl
libiconv
zlib
#wget https://curl.haxx.se/download/curl-7.54.1.tar.gz
#wget http://zlib.net/zlib-1.2.11.tar.gz
#wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.8.tar.gz
#tar zxvf curl-7.54.1.tar.gz
# tar zxvf zlib-1.2.11.tar.gz
# tar zxvf libiconv-1.8.tar.gz
# configure --prefix=/data/server/libs/*
# make && make install
//以上根据实际情况自行安装即可
#./configure --prefix=/data/server/php/ --with-config-file-path=/data/server/php/etc/ --enable-mysqlnd --with-mysqli=/usr/local/Cellar/mysql/5.7.18_1/bin/mysql_config --with-pdo-mysql=/usr/local/Cellar/mysql/5.7.18_1/ --with-freetype-dir --with-jpeg-dir --with-png-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --enable-calendar --enable-opcache --with-openssl=/usr/local/openssl/ --with-zlib=/usr/local/opt/zlib/ --with-curl=/usr/local/opt/curl/ --with-iconv=/usr/local/opt/libiconv/
#vim Makefile
#make && make install
#data/server/php/bin/php -v //查看是否安装成功
下边非常重要,否则macx 10+安装不上的,因为没有ld命令
这里需要注意,configure后就要开始编辑Makefile文件了,
如果不完整,可以根据错误进行增加替换,但方式一样。
#vim Makefile
#找到112行或者EXTRA_LIBS,做如下替换
EXTRA_LIBS = -lz -lresolv -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lcrypto -lm -lxml2 -lz -licucore -lm -lcurl -lldap -lz -lxml2 -lz -licucore -lm -lfreetype -lmysqlclient -lmysqlclient -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm /usr/local/openssl/lib/libssl.dylib /usr/local/openssl/lib/libcrypto.dylib /usr/local/Cellar/libiconv/1.15/lib/libiconv.dylib
例如里边有lssl 那么把全部它删掉,替换成 /usr/local/openssl/lib/libssl.dylib 如果找不全可以根据实际报错同理处理
/**imagick**/
#wget http://pecl.php.net/get/imagick-3.4.3.tgz
#tar zxvf imagick-3.4.3.tgz
#/data/server/php/bin/phpize
#brew install imagemagick
#./configure --with-php-config=/data/server/php/bin/php-config --with-imagick=/usr/local/opt/imagemagick/
#make && make install
/**memcached**/
#brew install libmemcached
#cd memcached-1.5.0
#/data/server/php/bin/phpize
#./configure --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11/ --with-php-config=/data/server/php/bin/php-config --with-libmemcached-dir=/usr/local/opt/libmemcached/
#make && make install
/**mongodb**/
#git clone https://github.com/mongodb/mongo-php-driver.git
#cd /mongo-php-driver/
#git submodule update --init
#/data/server/php/bin/phpize
#./configure --with-php-config=/data/server/php/bin/php-config --with-openssl-dir=/usr/local/opt/openssl/
#make & make install
#vim /data/server/php/etc/php-fpm.conf
/**在global下边添加一行pid**/
#pid = run/php-fpm.pid
/**在下边文件里插入附件里的脚本文件**/
#vim /data/server/php/start.sh
/**default.conf**/
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
# Discourage deep links by using a permanent redirect to home page of HTTPS site
return 301 https://$host;
# Alternatively, redirect all HTTP links to the matching HTTPS page
# return 301 https://$host$request_uri;
}
/**local demo conf**/
server {
listen 443 ssl;
server_name localhost 127.0.0.1;
//HSTL协议添加,确保第一次访问也安全
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
ssl_certificate /data/server/nginx/ssl/server.crt;
ssl_certificate_key /data/server/nginx/ssl/server_nopwd.key;
index index.html index.htm index.php;
root /data/www/localhost/web/;
location / {
if (-d $request_filename) {
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?s=/$1 last;
}
}
location ~ \.php$ {
index index.php;
fastcgi_pass fastcgi_backend;
fastcgi_param SCRIPT_FILENAME;
$document_root$fastcgi_script_name;
include fastcgi_params;
include fastcgi.conf;
}
}
/**start.sh**/
DESC="php-fpm daemon"
NAME=php-fpm
# php-fpm路径
DAEMON=/data/server/php/sbin/$NAME
# 配置文件路径
CONFIGFILE=/data/server/php/etc/$NAME.conf
# PID文件路径(在php-fpm.conf设置)
PIDFILE=/data/server/php/var/run/$NAME.pid
SCRIPTNAME=/data/server/php/start.sh
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
rh_start() {
$DAEMON -y $CONFIGFILE || echo -n " already running"
}
rh_stop() {
kill -QUIT `cat $PIDFILE` || echo -n " not running"
}
rh_reload() {
kill -HUP `cat $PIDFILE` || echo -n " can't reload"
}
case "$1" in
start)
echo "Starting $DESC: $NAME"
rh_start
#echo "\n"
;;
stop)
echo "Stopping $DESC: $NAME"
rh_stop
#echo "\n"
;;
reload)
echo "Reloading $DESC configuration..."
rh_reload
echo "reloaded."
;;
restart)
echo "Restarting $DESC: $NAME"
rh_stop
sleep 1
rh_start
#echo "\n"
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0