# srm **Repository Path**: guzhuyi/srm ## Basic Information - **Project Name**: srm - **Description**: No description available - **Primary Language**: PHP - **License**: BSD-3-Clause - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2016-07-06 - **Last Updated**: 2024-05-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 1. 安装Composer 略 2. 安装Composer 资源管理插件 ``` composer global require "fxp/composer-asset-plugin:~1.1.1" ``` 3. 安装yii框架和需要的其他类库 ``` composer install ``` ================================================ ## 初始化应用 进入项目根目录 1.初始化配置文件 ``` php init ``` 2. 修改数据库配置 `components['db']` configuration in `common/config/main-local.php` accordingly. 3. 数据迁移 `yii migrate`. 4. 配置web服务器 - for frontend `/path/to/yii-application/frontend/web/` and using the URL `http://w.hampsonedu.cc/` - for backend `/path/to/yii-application/backend/web/` and using the URL `http://t.hampsonedu.cc/` For Apache it could be the following: ```apache ServerName w.hampsonedu.cc DocumentRoot "/path/to/yii-application/frontend/web/" # use mod_rewrite for pretty URL support RewriteEngine on # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward the request to index.php RewriteRule . index.php # use index.php as index file DirectoryIndex index.php # ...other settings... ServerName t.hampsonedu.cc DocumentRoot "/path/to/yii-application/backend/web/" # use mod_rewrite for pretty URL support RewriteEngine on # If a directory or a file exists, use the request directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise forward the request to index.php RewriteRule . index.php # use index.php as index file DirectoryIndex index.php # ...other settings... ``` For nginx: ```nginx server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name w.hampsonedu.cc; root /path/to/yii-application/frontend/web/; index index.php; access_log /path/to/yii-application/log/frontend-access.log; error_log /path/to/yii-application/log/frontend-error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files $uri =404; #} #error_page 404 /404.html; # deny accessing php files for the /assets directory location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~* /\. { deny all; } } server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name t.hampsonedu.cc; root /path/to/yii-application/backend/web/; index index.php; access_log /path/to/yii-application/log/backend-access.log; error_log /path/to/yii-application/log/backend-error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files $uri =404; #} #error_page 404 /404.html; # deny accessing php files for the /assets directory location ~ ^/assets/.*\.php$ { deny all; } location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~* /\. { deny all; } } ``` 5. 修改hosts文件 - Windows: `c:\Windows\System32\Drivers\etc\hosts` - Linux: `/etc/hosts` Add the following lines: ``` 127.0.0.10 w.hampsonedu.cc 127.0.0.10 t.hampsonedu.cc ``` 访问应用 前台:w.hampsonedu.cc 后台:t.hampsonedu.cc