nginx + symfony2 + hhvm 的虚拟主机设置
Vhost settings for nginx + symfony2 + hhvm
我找不到任何人清楚地解释应该如何设置 symfony2 的虚拟主机,这是我第一次使用 puphpet、nginx 和 hhvm。希望你们中的一些人能帮助我。
我可以轻松上网 redwood.thomas.dev/app.php 或 redwood.thomas.dev/app_dev.php我去实际 url redwood.thomas.dev/app.php/login 它停止工作。另外,如果我转到 address.dev,我会得到一个文件概述,它不会转到索引文件 (app.php)
puphpet 设置我尝试了几种变体,我 post 这个是因为它适用于旧的 Yii 应用程序。
location_redwood_1:
location: /
autoindex: 'off'
internal: false
try_files:
- $uri
- $uri/
- /app.php$is_args$args
fastcgi: ''
fastcgi_index: ''
fastcgi_split_path: ''
location_redwood_2:
location: '~ \.php$'
autoindex: 'off'
internal: false
try_files:
- $uri
- $uri/
- /app.php$is_args$args
fastcgi: '127.0.0.1:9000'
fastcgi_index: app_dev.php
fastcgi_split_path: '^(.+\.php)(/.*)$'
fast_cgi_params_extra:
- 'SCRIPT_FILENAME $request_filename'
- 'APP_ENV dev'
它导致此配置:
server {
listen *:80;
server_name redwood.thomas.dev www.redwood.thomas.dev;
client_max_body_size 1m;
root /var/www/redwood/web;
index app.php app_dev.php;
access_log /var/log/nginx/nxv_8kzrp075w1ra.access.log;
error_log /var/log/nginx/nxv_8kzrp075w1ra.error.log;
location ~ \.php$ {
root /var/www/redwood/web;
fastcgi_index app_dev.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $uri $uri/ /app.php$is_args$args;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param APP_ENV dev;
}
location / {
root /var/www/redwood/web;
try_files $uri $uri/ /app.php$is_args$args;
autoindex on;
index index.html index.htm index.php;
}
sendfile off;
}
经过多次尝试,我确定了这个似乎有效的配置。希望它对某人有所帮助。
nxv_8kzrp075w1ra:
server_name: redwood.thomas.dev
server_aliases:
- www.redwood.thomas.dev
www_root: /var/www/redwood/web
listen_port: '80'
index_files:
client_max_body_size: 20m
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_port: '443'
ssl_protocols: ''
ssl_ciphers: ''
rewrite_to_https: '1'
spdy: '1'
locations:
location_redwood_1:
location: /
try_files:
- $uri
- '@rewriteapp'
location_redwood_2:
location: '@rewriteapp'
rewrite_rules:
- '^(.*)$ /app.php/ last'
location_redwood_3:
location: '~ ^/(app|app_dev|config)\.php(/|$)'
autoindex: 'off'
internal: false
try_files:
- $uri
- $uri/
- /app.php$is_args$args
fastcgi: '127.0.0.1:9000'
fastcgi_index: app_dev.php
fastcgi_split_path: '^(.+\.php)(/.*)$'
fast_cgi_params_extra:
- 'SCRIPT_FILENAME $document_root$fastcgi_script_name'
- 'APP_ENV dev'
我找不到任何人清楚地解释应该如何设置 symfony2 的虚拟主机,这是我第一次使用 puphpet、nginx 和 hhvm。希望你们中的一些人能帮助我。
我可以轻松上网 redwood.thomas.dev/app.php 或 redwood.thomas.dev/app_dev.php我去实际 url redwood.thomas.dev/app.php/login 它停止工作。另外,如果我转到 address.dev,我会得到一个文件概述,它不会转到索引文件 (app.php)
puphpet 设置我尝试了几种变体,我 post 这个是因为它适用于旧的 Yii 应用程序。
location_redwood_1:
location: /
autoindex: 'off'
internal: false
try_files:
- $uri
- $uri/
- /app.php$is_args$args
fastcgi: ''
fastcgi_index: ''
fastcgi_split_path: ''
location_redwood_2:
location: '~ \.php$'
autoindex: 'off'
internal: false
try_files:
- $uri
- $uri/
- /app.php$is_args$args
fastcgi: '127.0.0.1:9000'
fastcgi_index: app_dev.php
fastcgi_split_path: '^(.+\.php)(/.*)$'
fast_cgi_params_extra:
- 'SCRIPT_FILENAME $request_filename'
- 'APP_ENV dev'
它导致此配置:
server {
listen *:80;
server_name redwood.thomas.dev www.redwood.thomas.dev;
client_max_body_size 1m;
root /var/www/redwood/web;
index app.php app_dev.php;
access_log /var/log/nginx/nxv_8kzrp075w1ra.access.log;
error_log /var/log/nginx/nxv_8kzrp075w1ra.error.log;
location ~ \.php$ {
root /var/www/redwood/web;
fastcgi_index app_dev.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $uri $uri/ /app.php$is_args$args;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param APP_ENV dev;
}
location / {
root /var/www/redwood/web;
try_files $uri $uri/ /app.php$is_args$args;
autoindex on;
index index.html index.htm index.php;
}
sendfile off;
}
经过多次尝试,我确定了这个似乎有效的配置。希望它对某人有所帮助。
nxv_8kzrp075w1ra:
server_name: redwood.thomas.dev
server_aliases:
- www.redwood.thomas.dev
www_root: /var/www/redwood/web
listen_port: '80'
index_files:
client_max_body_size: 20m
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_port: '443'
ssl_protocols: ''
ssl_ciphers: ''
rewrite_to_https: '1'
spdy: '1'
locations:
location_redwood_1:
location: /
try_files:
- $uri
- '@rewriteapp'
location_redwood_2:
location: '@rewriteapp'
rewrite_rules:
- '^(.*)$ /app.php/ last'
location_redwood_3:
location: '~ ^/(app|app_dev|config)\.php(/|$)'
autoindex: 'off'
internal: false
try_files:
- $uri
- $uri/
- /app.php$is_args$args
fastcgi: '127.0.0.1:9000'
fastcgi_index: app_dev.php
fastcgi_split_path: '^(.+\.php)(/.*)$'
fast_cgi_params_extra:
- 'SCRIPT_FILENAME $document_root$fastcgi_script_name'
- 'APP_ENV dev'