https://github.com/sihar/yii2-nginx-configuration
https://github.com/sihar/yii2-nginx-configuration
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sihar/yii2-nginx-configuration
- Owner: sihar
- Created: 2019-09-20T09:39:56.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-20T10:00:04.000Z (almost 7 years ago)
- Last Synced: 2025-05-13T17:15:57.709Z (about 1 year ago)
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yii2-nginx-configuration
## Langkah-langkah konfigurasi nginx untuk yii2 di windows
- Start php cgi
```
path_php>php-cgi.exe -b 127.0.0.1:9000
```
- Lakukan konfigurasi di file nginx.conf
```
server {
listen 8081;
server_name localhost;
root html/aplikasi1/web;
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
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;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}
server {
listen 8082;
server_name localhost;
root html/aplikasi2/web;
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
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;
try_files $uri =404;
}
location ~* /\. {
deny all;
}
}
```
- Jalankan aplikasi nginx
```
path_nginx> nginx.exe
```
- Buka url dan port sesuai konfigurasi nginx, http://localhost:8081 dan http://localhost:8082
## Referensi
https://www.yiiframework.com/doc/guide/2.0/en/start-installation#recommended-nginx-configuration
https://www.mkyong.com/nginx/nginx-php-on-windows/