安装composer
composer.json 声明PHP依赖的第三方扩展的文件
加载该文件需要安装composer, composer是PHP的一个类库依赖管理机制,运行composer需要 php 5.3以上版本, 并且确定PHP CURL 扩展可用。
nginx的配置情况
下面先附上nginx的配置供参考
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| server { listen 80;
root /data/cms-message/public; index index.php index.html index.htm;
server_name localhost;
sendfile on;
error_log /var/log/nginx/aa.log debug;
if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1 last; break; } error_page 404 /404.html;
error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; }
location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $uri; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { expires 5d; } location ~ /\. { log_not_found off; deny all; } }
|
laravel的主目录配置
1
| root /data/cms-message/public
|
url重写
1 2 3 4 5 6
| if (!-e $request_filename) { rewrite ^/(.*)$ /index.php?/$1 last; break; }
|
laravel规则下的url重写
数据库配置
根目录.env
1 2 3 4 5 6
| DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_DATABASE=cms_message DB_USERNAME=root DB_PASSWORD= DB_PREFIX=msg_
|
为安全起见,将root权限设置为只能本地访问。