Appearance
通用部署②/③ 开发人员使用
服务器推荐
阿里云
打开以下活页选择并购买云服务器,价格会更优惠。也可以从【控制台】,选择ESC服务器或轻量级服务器,直接购买。
活动1 | 活动2 | 活动3 |
---|---|---|
新人优惠 | 新老优惠 | 企业扶持 |
腾讯云
打开以下活页选择并购买云服务器,价格会更优惠。也可以从【控制台】,选择云服务器或轻量级服务器,直接购买。
活动1 | 活动2 | 活动3 |
---|---|---|
精选优惠 | 领取优惠券 | 企业专区 |
提示
获取更大更多优惠活动,咨询服务器相关问题,请加微信。
项目入口
项目静态资源入口目录:server/public
项目PHP入口文件:server/public/index.php
PHP扩展
fileinfo
、PDO_MYSQL
、allow_url_fopen
、GD2
、DOM
、redis
nginx配置
nginx全配置
nginx
server {
listen 80;
listen 443 ssl;
server_name www.li ke admin.localhost;
ssl_certificate /ssl/www.likeadmin.localhost.crt;
ssl_certificate_key /ssl/www.localhost.key;
access_log /logs/demo.likeadmin.cnt_access_nginx.log;
error_log /logs/demo.likeadmin.cn_error_nginx.log;
client_max_body_size 5M;
location / {
root likeadmin/server/public;#入口文件目录
index index.html index.htm index.php;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ /.*\.php/ {
rewrite ^(.*?/?)(.*\.php)(.*)$ /$2?s=$3 last;
break;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME likeadmin/server/public$fastcgi_script_name; #入口文件目录
include fastcgi_params;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
}
nginx伪静态部分
nginx
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
apache配置
apache权配置
apache
<VirtualHost *:80>
ServerName www.likeadmin.localhost
DocumentRoot /path/to/likeadmin/server/public
ErrorLog ${APACHE_LOG_DIR}/demo.likeadmin.cn_error_apache.log
CustomLog ${APACHE_LOG_DIR}/demo.likeadmin.cnt_access_apache.log combined
<Directory /path/to/likeadmin/server/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Rewrite settings
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?s=$1 [L]
# PHP settings
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
# Error page handling
ErrorDocument 500 /50x.html
ErrorDocument 502 /50x.html
ErrorDocument 503 /50x.html
ErrorDocument 504 /50x.html
# Disable favicon logging
<Files favicon.ico>
LogLevel emerg
CustomLog /dev/null common
</Files>
</VirtualHost>
<VirtualHost *:443>
ServerName www.likeadmin.localhost
DocumentRoot /path/to/likeadmin/server/public
ErrorLog ${APACHE_LOG_DIR}/demo.likeadmin.cn_error_apache.log
CustomLog ${APACHE_LOG_DIR}/demo.likeadmin.cnt_access_apache.log combined
SSLEngine on
SSLCertificateFile /ssl/www.likeadmin.localhost.crt
SSLCertificateKeyFile /ssl/www.localhost.key
<Directory /path/to/likeadmin/server/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Rewrite settings
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?s=$1 [L]
# PHP settings
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
# Error page handling
ErrorDocument 500 /50x.html
ErrorDocument 502 /50x.html
ErrorDocument 503 /50x.html
ErrorDocument 504 /50x.html
# Disable favicon logging
<Files favicon.ico>
LogLevel emerg
CustomLog /dev/null common
</Files>
</VirtualHost>
apache伪静态
apache
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
安装
部署成功后,访问域名即可安装likeadmin,安装后生成配置文件server/.env
。server/.env
包含Mysql、Redis等配置信息。
访问地址
PC端后台访问:http://域名/admin
PC端前台访问:http://域名/pc
移动端访问:http://域名/mobile