Install symfony2 on nginx not load css - symfony

I have a problem, I want to install symfony2 on nginx, the framework is installed but is not loaded css,js,img. So I view only the home page without style. My installation :
server {
listen 80;
server_name symfony.dev;
root /home/vagrant/Workspace/symfony/web;
access_log off;
error_log /var/log/nginx/symfony.dev-error.log error;
location / {
# try to serve file directly, fallback to app.php
try_files $uri /app.php$is_args$args;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
}
I looked in /etc/nginx/nginx.conf, there is :
include /etc/nginx/mime.types;
And in mime.types exists css,js, etc.
Help me please!
Thnx in advance

You have to execute this command to install the assets in web directory :
php app/console assets:install

Related

Magento2 NGINX run external PHP scripts

Magento2 site setup on AWS with NGINX. Site working fine.
I am trying to allow PHP scripts to run if they are in a specific folder, but they always 404.
I have placed the following inside my nginx config file, and restarted nginx:
location /custom_tests/ {
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_buffers 1024 4k;
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
I am trying to access scripts that are in sub directories of the 'custom_tests' folder, but i have also added an index.php in the 'custom_tests' folder itself. All i get is 404 not found.
I have the above NGINX entry just above the following block in the config file:
# PHP entry point for main application
location ~ (index|get|static|report|404|503|health_check)\.php$ {

Nginx white page with no error

I'm new to nginx. I'm trying to use kubernetes with nginx. But I get a blank page and no error... what can I do ?
Here my configuration :
server {
listen 80;
root /var/www/project/web;
location / {
# try to serve file directly, fallback to app.php
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 unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# 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;
}
Edit :
I run it in a docker-compose, now I get this when I launch :
web_1 | * Restarting PHP5 FastCGI Process Manager php5-fpm
Edit 2
connect() to unix:/var/run/php/php7.0-fpm.sock failed (2: No such file
or directory) while connecting to upstream

symfony2 on nginx 500 internal server error

I am new to symfony. I am trying to setup symfony2 on ubuntu server with nginx. but it shows 500 internal server error. I have this server running some laravel projects as well and its find
Anyone can help what the problem is?
my nginx configuration is :
server {
listen 80;
root /home/ubuntu/test-symfony/web;
index app.php;
# Make site accessible from http://localhost/
server_name symfony.jonesjapriady.com http://symfony.jonesjapriady.com;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
location / {
try_files $uri /app.php?$query_string;
}
location ~ ^/(app_dev|app_test.php|app)\.php(/|$) {
include fastcgi_params;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
}
}

Laravel 4.1 first route add, gives error.

I just installed laravel 4.1 using the recommended install option.
composer create-project laravel/laravel your-project-name --prefer-dist
All went fine, as I was able to see the default page inside /public/ then I removed the .htaccess file since I am using nginx and added try_files $uri $uri/ /index.php?$query_string; for nginx inside the location ~ \.php$ { ... } then I created a simple route
Route::get('/about', function()
{
return "about page";
});
but I am getting the common 404 Not Found nginx/1.0.15 from nginx. I have given 777 permission even to the entire laravel folder. What could be the problem?
You need to point your nginx to the public folder. Here's one of my site config files in nginx:
server {
listen 80 default;
server_name _;
root /var/www/laravel/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
This way, you can browse to your laravel project by requesting: http://localhost/
Watch out: maybe you php cgi is different: use the fastcgi_pass rule you already had.
And readding the .htaccess file doesn't do any harm.
Hope this works for you.

nagis cache remote website

i had installe nginx on my local machine,
my problem is i would like to do a cache for my website .
help to configure nginx
this my configuration
server
{
server_name .mywebsite.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
root /var/www/example.com/html;
index index.php index.html index.htm;
# use fastcgi for all php files
location ~ \.php$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}
}
but i dosen't had any static content on my local machine
help please best regards

Resources