ubuntu 安装 lnmp

—-php7—-
sudo apt-get install -y autoconf libtool re2c libxml2-dev openssl libcurl4-openssl-dev libbz2-dev libjpeg-dev libpng12-dev libfreetype6-dev libldap2-dev libmcrypt-dev libmysqlclient-dev libxslt1-dev libxt-dev libpcre3-dev libxpm-dev libt1-dev libgmp-dev libpspell-dev librecode-dev libreadline6-dev bison libtidy-dev make

wget http://php.net/distributions/php-7.1.7.tar.gz

./configure –prefix=/usr/local/php7 –exec-prefix=/usr/local/php7 –bindir=/usr/local/php7/bin –sbindir=/usr/local/php7/sbin –includedir=/usr/local/php7/include –libdir=/usr/local/php7/lib/php –mandir=/usr/local/php7/php/man –with-config-file-path=/usr/local/php7/etc –with-mysql-sock=/var/run/mysql/mysql.sock –with-mcrypt=/usr/include –with-mhash –with-openssl –with-mysql=shared,mysqlnd –with-mysqli=shared,mysqlnd –with-pdo-mysql=shared,mysqlnd –with-gd –with-iconv –with-zlib –enable-zip –enable-inline-optimization –disable-debug –disable-rpath –enable-shared –enable-xml –enable-bcmath –enable-shmop –enable-sysvsem –enable-mbregex –enable-mbstring –enable-ftp –enable-gd-native-ttf –enable-pcntl –enable-sockets –with-xmlrpc –enable-soap –without-pear –with-gettext –enable-session –with-curl –with-jpeg-dir –with-freetype-dir –enable-opcache –enable-fpm –enable-fastcgi –with-fpm-user=meicai –with-fpm-group=meicai –without-gdbm –with-mcrypt=/usr/local/related/libmcrypt –disable-fileinfo

sudo make && sudo make test
sudo make install
sudo ln -s /usr/local/php7/bin/php /usr/bin/php

sudo cp /home/meicai/php.ini-production /usr/local/php7/etc/php.ini
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
sudo /usr/local/php7/sbin/php-fpm

—-php7-redis—
wget -O php7redis.zip https://github.com/phpredis/phpredis/archive/php7.zip
/usr/local/php7/bin/phpize
./configure –with-php-config=/usr/local/php7/bin/php-config
sudo make && sudo make test && sudo make install

–添加 php.ini–
extension_dir = “/usr/local/php7/lib/php/extensions/no-debug-non-zts-20160303/”
extension=”redis.so”
-----------
sudo killall php-fpm
sudo /usr/local/php7/sbin/php-fpm

——-nginx—–
wget http://nginx.org/download/nginx-1.13.2.tar.gz
./configure –prefix=/usr/local/nginx –sbin-path=/usr/local/nginx/sbin/nginx –conf-path=/usr/local/nginx/conf/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx/nginx.pid –lock-path=/var/lock/nginx.lock –user=nginx –group=nginx –with-http_ssl_module –with-http_stub_status_module –with-http_gzip_static_module –http-client-body-temp-path=/var/tmp/nginx/client/ –http-proxy-temp-path=/var/tmp/nginx/proxy/ –http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ –http-uwsgi-temp-path=/var/tmp/nginx/uwsgi –http-scgi-temp-path=/var/tmp/nginx/scgi –with-pcre

sudo adduser –system –no-create-home –disabled-password –group nginx
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
sudo /usr/local/nginx/sbin/nginx -s reload

sudo chown -R meicai:meicai /usr/local
sudo ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

–添加重写–
if (!-e $request_filename){
rewrite ^/(.*) /index.php?r=$1 last;
}
—-mysql—-
sudo apt-get install mysql-server

Jason.wang

When you find your talent can't afford to be ambitious, be quiet and study !

You may also like...