我有一個域,我需要在不同文件夾中託管很多symfony 3項目。例如:在同一個域上託管多個Symfony項目
www.domain.com/project1 www.domain.com/project2 ...
我目前的nginx的conf是:
server {
server_name domain.fr www.domain.fr;
root /var/proximiteclient/www/web;
location/{
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
#internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
error_log /var/log/nginx/domain_error.log;
access_log /var/log/nginx/domain_access.log;
listen 80; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.fr/fullchain.pem; # manag$
ssl_certificate_key /etc/letsencrypt/live/domain.fr/privkey.pem; # man$
ssl_session_cache shared:le_nginx_SSL:1m; # managed by Certbot
ssl_session_timeout 1440m; # managed by Certbot
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # managed by Certbot
ssl_prefer_server_ciphers on; # managed by Certbot
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE$
#Redirect non-https traffic to https
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
對不起,我不能放在文本模式下它不工作:(
Thansk非常感謝!
你錯過了nginx的配置部分 – smarber
加入!對不起,它拒絕我的conf :( –
我已經添加了我的nginx conf! –