Recently, I found an interesting framework Laravel written by PHP. i have never used PHP to write any
software. I searched the Internet to find any Blog written by Laravel. At last, I found one called PJ Blog,
which is written by Pigjian. I tried to build it with my curiosity.
1.Install PHP7
sudo apt-get install php7.0-fpm php7.0-mysql php7.0-common php7.0-mbstring php7.0-gd php7.0-json php7.0-cli php7.0-curl libapache2-mod-php7.0 php7.0-xml php7.0-mcrypt
2.Install Nginx(openresty)
wget https://openresty.org/download/openresty-1.11.2.1.tar.gz tar -xvf openresty-1.11.2.1.tar.gz
apt-get install -y libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential apt-get install -y libxslt-dev libxml2-dev apt-get install -y libgd-dev libgd2-xpm-dev apt-get install -y geoip-database libgeoip-dev
./configure --prefix=/usr/local/openresty --with-debug --with-cc-opt='-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -O2' --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module
make && make install
mkdir -p /var/lib/nginx/body mkdir -p /var/log/nginx
ln -s /usr/local/openresty/nginx/sbin/nginx /usr/bin/nginx
3.Install Composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer composer -V
4.Download and Install PJ Blog
composer create-project jcc/blog
composer update nothing
composer install -vvv
npm install
cp .env.example .env # modify database.
php artisan blog:install
5. Configure Nginx
groupadd www-data
useradd www-data -g www-data
user www-data www-data; worker_processes 1; error_log /var/logs/nginx/error.log; #error_log /var/logs/nginx/error.log notice; #error_log /var/logs/nginx/error.log info; pid /var/logs/nginx/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; charset utf-8; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $bytes_sent $request_length "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time'; log_format proxy '$http_x_real_ip - $remote_user [$time_local] "$request" ' '$status $bytes_sent $request_length "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time'; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 30; gzip on; gzip_static on; gzip_http_version 1.0; gzip_vary on; gzip_comp_level 5; gzip_min_length 1024; gzip_buffers 4 16k; gzip_types text/plain application/json application/x-javascript application/javascript text/css image/png image/jpeg image/gif; proxy_buffer_size 64k; proxy_buffers 4 512k; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; server { listen 80 default_server; root /var/www/blog/public; index index.php index.html index.htm; server_name localhost; location / { try_files $uri $uri/ /index.php?$query_string; include mime.types; } location ~ .php$ { try_files $uri /index.php =404; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } }
mv blog /var/www/
chown -R www-data:www-data /var/www/blog
chmod -R 775 /var/www/blog/storage
More information, click here
Link: http://www.cnblogs.com/zhuangzebo/p/6281986.html