我仍然无法理解我服务器中发生的事情 当我通过/ public_html中的服务器推送我的代码并想要获得我的应用程序的主页时这样:
HTTP:/www.example.com/web /
服务器向我显示/ web的内容( / web 中存在的文件和目录)
并且在我按照步骤的命令行在该链接中部署symfony 3之后发生了这种情况: https://symfony.com/doc/3.1/deployment.html
我仍然无法理解那里发生了什么!!
任何帮助都会非常感激!
答案 0 :(得分:1)
1-)
yum install nginx
2 - )service nginx start
3-)将Nginx配置添加到/etc/nginx/conf.d/project_name.conf
server{
set $web_host "domain_name";
set $web_root "web_directory";
server_name $web_host;
root $web_root;
location / {
try_files $uri /app.php$is_args$args;
}
# DEV
# This rule should only be placed on your development environment
# In production, don't include this and don't deploy app_dev.php or config.php
# location ~ ^/(app_dev|config)\.php(/|$) {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_split_path_info ^(.+\.php)(/.*)$;
# include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
# fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
# fastcgi_param DOCUMENT_ROOT $realpath_root;
# }
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
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;
}
error_log /var/log/nginx/project_error.log;
access_log /var/log/nginx/project_access.log;
}
4-)`chmod -R nginx:nginx / var / www / html / project``
5-)service nginx restart
和service php-fpm restart