Table of Contents
1. SSH 配置
2. LNMP环境搭建
3. 迁移git 仓库
3.1 为防止ssh中断使用screen
3.2 拷贝仓库到当前文件
3.3 安装git服务器
4 配置开发环境
Home Backend Development PHP Tutorial LNMP环境+Laravel快速搭建

LNMP环境+Laravel快速搭建

Jun 23, 2016 pm 01:15 PM

1. SSH 配置

生成本机密码

ssh-keygen -t rsa -P ''

touch authorized_keys

把本机的 id_rsa.pub 复制到 authorized_keys里面

添加虚拟机到.zrshrc

2. LNMP环境搭建

参考教程 http://lnmp.org

    screen -S lnmp
Copy after login

CentOS系统下执行

   wget -c http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz && tar zxf lnmp1.1-full.tar.gz && cd lnmp1.1-full && ./centos.sh
Copy after login

安装php 5.5

设置laravel 重写规则

 vim /usr/local/nginx/conf/
Copy after login

编辑laravel.conf

location / {    try_files $uri $uri/ /index.php?$query_string;}
Copy after login

伪静态

vim /usr/local/nginx/conf/vhost/域名.conf
Copy after login

修改为root /home/wwwroot/test.plantbabe.com/public

重启nignx

/etc/init.d/nginx restart
Copy after login

安装composer

curl -sS https://getcomposer.org/installer | php
Copy after login

升级mysql 到5.6.23参见 lnmp.org

修改mysql访问权限

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
Copy after login

用sequel pro 访问

3. 迁移git 仓库

3.1 为防止ssh中断使用screen

screen 教程

3.2 拷贝仓库到当前文件

scp -r root@121.40.145.240:/home/git ~

3.3 安装git服务器

修改文件所有者 chown git:git gitosis

chown git:git gitosis

修改 gitosis.conf 添加权限

[group gitosis-admin]writable = gitosis-adminmembers = xyongxin@gmail.com root@115.28.237.149[group hellow]writable = teamworkmembers = xyongxin@gmail.com root@115.28.237.149[group larabook ]writable = larabookmembers = xyongxin@gmail.com root@115.28.237.149[group plantbabe ]writable = plantbabemembers = xyongxin@gmail.com root@115.28.237.149
Copy after login

测试在本地

mkdir teamwork-oricd teamwork-ori/git initecho "/*add something*/" > hellogit add .git commit -am "initial version"git remote add origin git@192.168.1.39:teamwork.gitgit push origin master
Copy after login

4 配置开发环境

.env.php

<?php/** * Created by PhpStorm. * Users: xiongyongxin * Date: 14-10-20 * Time: 下午10:22 */return [    'DB_HOST' => 'localhost',    'DB_USERNAME' => 'homestead',    'DB_PASSWORD' => 'secret',    'DB_NAME' => 'plantbabe',    'debug_status' => true,    'TOKEN'     => 'bear',    'APP_ID'     => 'wx91b17a7364915b53',    'APP_SECRET' => '2faf63201cab4470e4ecf4ba3de3e325',    'expire' => 1800 // 微信qrCode的时间];
Copy after login

enable the php_fileinfo extension由于我的环境是Lnmp.org提供的一键安装包,重启服务后依然有报错:https://phphub.org/topics/267

$ php -i | grep php.iniConfiguration File (php.ini) Path => /usr/local/php/etcLoaded Configuration File => /usr/local/php/etc/php.ini

PHP Warning: PHP Startup: Unable to load dynamic library'/usr/local/lib/php/extensions/no-debug-non-zts-20121212/php_fileinfo.so....打开对应文件夹发现缺少此项文件;

我们可以通过pear或者pecl安装扩展包,我们这里用phpize;通过phpize安装必须包含有相应版本的php安装包,我用的是php-5.5.15.tar.gz:

解压安装包,找到php_fileinfo的文件夹,执行phpize$ cd php-5.5.15/ext/fileinfo/$ /usr/local/php/bin/phpize确认/usr/local/php/bin/php-config的地址,配置configure 到 php-config:$ ./configure --with-php-config=/usr/local/php/bin/php-config*执行 make和 make install获得相应的fileinfo.so文件,系统将返回文件的地址,如果没有自动配置到相应文件夹,那么可手动拷贝过去

/usr/local/lib/php/extensions/no-debug-non-zts-20121212/fileinfo.so由于我们php.ini配置的是 extension=php_fileinfo.so ,因此我们应该把fileinfo.so 重命名为php_fileinfo.so重启服务$ /root/lnmp restart 大功告成!

pulic/images/设置成可读可写可执行

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Announcement of 2025 PHP Situation Survey Announcement of 2025 PHP Situation Survey Mar 03, 2025 pm 04:20 PM

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

See all articles