I currently have an nginx setup with the following config:
worker_processes 10;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 4000;
}
http {
include mime.types;
default_type application/octet-stream;
access_log off;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 30;
keepalive_requests 100000;
ssl_session_timeout 10m;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
ssl_ciphers ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH;
ssl_prefer_server_ciphers on;
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
# http server
server {
proxy_pass_header Server;
listen 80; # IPv4
server_name localhost;
## Parameterization using hostname of access and log filenames.
access_log logs/localhost_access.log;
error_log logs/localhost_error.log;
## Root and index files.
root html;
index index.php index.html index.htm;
## If no favicon exists return a 204 (no content error).
location = /favicon.ico {
try_files $uri =204;
log_not_found off;
access_log off;
}
## Don't log robots.txt requests.
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## Try the requested URI as files before handling it to PHP.
location / {
## Regular PHP processing.
location ~ \.php$ {
root html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
## Static files
location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
expires max;
log_not_found off;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay on;
## Set the OS file cache.
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
}
## Keep a tab on the 'big' static files.
location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
expires 30d;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
}
} # / location
} # end http server
# https server
server {
listen 443 spdy ssl;
server_name localhost;
ssl_certificate my.crt;
ssl_certificate_key my.key;
## Parameterization using hostname of access and log filenames.
access_log logs/localhost_access.log;
error_log logs/localhost_error.log;
## Root and index files.
root html;
index index.php index.html index.htm;
## If no favicon exists return a 204 (no content error).
location = /favicon.ico {
try_files $uri =204;
log_not_found off;
access_log off;
}
## Don't log robots.txt requests.
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
## Try the requested URI as files before handling it to PHP.
location / {
## Regular PHP processing.
location ~ \.php$ {
root html;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
## Static files are served directly.
location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf)$ {
expires max;
log_not_found off;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
## Set the OS file cache.
open_file_cache max=1000 inactive=120s;
open_file_cache_valid 45s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
}
## Keep a tab on the 'big' static files.
location ~* ^.+\.(?:ogg|pdf|pptx?)$ {
expires 30d;
## No need to bleed constant updates. Send the all shebang in one
## fell swoop.
tcp_nodelay off;
}
} # / location
} # end https server
}
The web server seems to be lagging. Allowing .htaccess download periodically, sometimes an error will occur server side (or so I suspect) and the web server will begin serving pages that I did not request or that were previously requested (even if I explicitly demand index.php I will be served some other non-related page) overall it's a very worrisome behavior.
Can anyone give some clues?
To prevent downloading of .ht* files (ex .htaccess/.htpasswd) you have to add this line to your config
location ~ /\.ht { access_log off; log_not_found off; deny all; }
Please define your occurrently error more accurate without defined error messages it's impossible to give you some advice.
Related
I need to redirect both www to non www and HTTP to HTTPS with nginx. I can get it to redirect but then I get a `too many redirects' error.
I'm using the Azure AppService version of WordPress. This version uses the wordpress-alpine-php docker image, running nginx version 1.20.2.
The nginx.conf file includes:
/etc/nginx/conf.d/*.conf
/etc/nginx/modules-enabled/*.conf
I don't see a modules-enabled directory.
For the HTTP to https redirect, I added the following server directive to default.conf:
server {
listen 80;
server_name ---.com www.---.com;
return 301 https://---.com$request_uri;
}
After this, I get the "too many redirects" error.
I noticed the following server block also listens on port 80, so I changed it to 443. I still get the "too many redirects".
Below are my conf files. The only change I made was adding the server directive above, and changing the port to 443 in the original server directive.
How do I get these redirects to work?
Could there be other files involved?
/etc/nginx/nginx.conf
user nginx;
worker_processes auto;
# send nginx error logs to stderr
error_log /dev/stderr error;
pid /var/run/nginx.pid;
load_module modules/ngx_http_brotli_static_module.so;
load_module modules/ngx_http_brotli_filter_module.so;
events {
worker_connections 10000;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log off;
sendfile on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/modules-enabled/*.conf;
}
/etc/nginx/conf.d/default.conf
upstream php {
server unix:/var/run/php/php-fpm.sock;
#server 127.0.0.1:9000;
}
server {
listen 80;
server_name ---.com www.---.com;
return 301 https://---.com$request_uri;
}
server {
listen 443;
## Your website name goes here.
server_name _;
if ($http_x_forwarded_proto = "http") {
return 301 https://---.com$request_uri;
}
## Your only path reference.
root /home/site/wwwroot;
## This should be in your http block and if it is, it's not needed here.
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Add locations of phpmyadmin here.
location /phpmyadmin {
root /home/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /home/;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /home/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
sendfile off;
set $skip_cache 0;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
# Don't cache WooCommerce URLs
# Cart widgets are still a problem: https://github.com/emcniece/docker-wordpress/issues/3
if ($request_uri ~* "/(cart|checkout|my-account)/*$") {
set $skip_cache 1;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~* \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_read_timeout 300;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache off;
fastcgi_cache_valid 60m;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
You need to add ssl flag to your listen directive if you want to use HTTPS. And specify your SSL certificate - something like this:
server {
listen 443 ssl http2;
server_name ---.com;
ssl_session_cache shared:SSL:4m; # measured in megabytes, not minutes
ssl_buffer_size 4k; # reduced from the default 16k to minimize TTFB
ssl_session_timeout 30m;
ssl_session_tickets on; # Requires nginx >= 1.5.9 (SSL labs testing leads to SSL: error:14094085:SSL routines:SSL3_READ_BYTES:ccs received early)
ssl_dhparam /etc/ssl/dhparam.pem; # Generate with "openssl dhparam -out dhparam.pem 4096"
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.3 TLSv1.2;
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 valid=300s ipv6=off;
resolver_timeout 4s;
ssl_certificate /etc/ssl/fullchain.pem;
ssl_certificate_key /etc/ssl/key.pem;
.......
}
Over the past few days a TON of timeouts started appearing in the nginx logs out of the blue and after a lot of troubleshooting I haven't gotten anywhere.
Here are some specs:
The server is Ubuntu 14.04, running Nginx 1.4.6 and PHP 5.6. The application (though not entirely relevant to this problem) is running on Laravel 5.2. Physical specs for the server are 2 cpus & 8 GB memory. I can have anywhere from 50 to 100 users on the site at a time, and I'm expecting it to grow in the near future.
I've tried to add, increase and decrease the timeouts, added buffers, added fastcgi_keep_conn on;, and turned the access.log off to decrease used resources. I've also mirrored the required changes in the appropriate places across my nginx.conf, sites-enabled/site.conf, and php.ini. However these timeouts just keep happening. There are a few requests in my application that are very heavy on the server (large SQL requests, large API requests and the like) and these are the ones that the timeouts always occur on.
nginx.conf:
events {
worker_connections 2048;
multi_accept on;
}
http {
sendfile on;
# tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off; # do not expose nginx version
server_names_hash_bucket_size 64;
server_names_hash_max_size 512;
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_max_body_size 30M;
# Timeouts
# keepalive_timeout 15;
# send_timeout 15;
# client_header_timeout 15;
# client_body_timeout 15;
fastcgi_keep_conn on;
fastcgi_buffering on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_temp_file_write_size 16k;
fastcgi_max_temp_file_size 1024m;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 60;
fastcgi_read_timeout 60;
access_log off;
error_log /var/log/nginx/error.log;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
sites-enabled/site.conf:
# non-ssl to ssl
server {
listen 80;
server_name site.com api.site.com;
return 301 https://$host$request_uri;
}
server {
server_name site.com api.site.com;
root /home/user/sites/site.com/public;
listen 443; # LISTEN PORT MARKER
# SSL PLACEHOLDERS
ssl on;
ssl_certificate /etc/ssl/site.com/2019/crt;
ssl_certificate_key /etc/ssl/site.com/2019/key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # disable SSLv3
charset utf-8;
client_header_buffer_size 1k;
large_client_header_buffers 2 1k;
access_log off;
# access_log /var/log/nginx/site.com-access.log; # uncomment to enable
error_log /var/log/nginx/site.com-error.log error;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { deny all; }
index index.php index.htm index.html;
error_page 404 /index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
client_body_buffer_size 10k;
client_max_body_size 8m;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5.6-fpm.sock;
fastcgi_keep_conn on;
fastcgi_buffering on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_temp_file_write_size 16k;
fastcgi_max_temp_file_size 1024m;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 60;
fastcgi_read_timeout 60;
}
}
The thing is, I'm a web developer not a sysadmin. I've been flying blind here, trying to throw darts at a board that I can barely see. I'm not sure if I've done everything right and all I need is to upgrade my server and/or optimize my requests or if my nginx configuration is absolutely awful.
On my nginx server when i visit example.com/wp-admin or example.com/login i always see the home page of my site, but when i visit example.com/wp-login.php everything works (and login screen is showed).
Is there some config to do in nginx to make these urls (/wp-admin or wp-login) work again?
Note: Other posts permalinks like example.com/hello-world is working.
My configs files are:
1. /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
2. /etc/nginx/sites-available/worpdress.conf
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/example.com/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
#server_name 127.0.0.1;
server_name example.com www.example.com;
location /favicon.ico {
log_not_found off;
access_log off;
}
location /robots.tx {
allow all;
log_not_found off;
access_log off;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri /index.php?$args;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_intercept_errors on;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
3. /etc/nginx/snippets/fastcgi-php.conf
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
You appear to have a missing / in your try_files statement. It should be:
location / {
try_files $uri $uri/ /index.php?$args;
}
The second term ($uri/) should cause the URI /wp-admin to be redirected to /wp-admin/ and then invoke the file /wp-admin/index.php.
See this document for more.
I have Nginx with three domains.
The sites, alphabetically are d.com, g.com, and m.com.
All three sites are single site WordPress installations.
g.com is https with a letsencrypt certificate and loads as expected.
m.com is not https and loads as expected
d.com loads m.com instead of its own folder.
I've been searching and reading for two weeks now and I cannot sort out what I have done wrong.
NEW INFORMATION
I discovered that the DNS for this was still at my old host ( mt ), it was pointing here correctly, but I decided to move it to the new host ( linode ).
Now if I use www.d.com I get the correct site loading from the correct folder. But if I leave off the www and just use d.com, I get redirected to www.m.com as a full redirect.
/etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 150M;
# server_tokens off;
server_names_hash_bucket_size 64;
# server_name_in_redirect off;
#fastcgi
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
# /snippits/ssl-params.conf
##
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
#ssl_prefer_server_ciphers on;
##
# Logging Settings
# Logs set in server blocks
##
error_log /var/log/nginx/http_error.log error;
##
# Gzip Settings
# /conf.d/gzip.conf
##
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
/etc/nginx/sites-available/d.com
server {
listen 80;
listen [::]:80;
server_name d.com www.d.com;
include snippets/expires-headers.conf;
root /var/www/html/d.com/public_html;
index index.php;
access_log /var/log/nginx/d.com/www-access.log;
error_log /var/log/nginx/d.com/www-error.log error;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html/d.com/public_html$fastcgi_script_name;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
/etc/nginx/sites-available/g.com
server {
listen 80;
listen [::]:80;
server_name g.com www.g.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /var/lib/acme/live/g.com/fullchain;
ssl_certificate_key /var/lib/acme/live/g.com/privkey;
include snippets/ssl-params.conf;
include snippets/expires-headers.conf;
server_name g.com www.g.com;
root /var/www/html/g.com/public_html;
index index.html index.php;
access_log /var/log/nginx/g.com/www-access.log;
error_log /var/log/nginx/g.com/www-error.log error;
location /.well-known/acme-challenge/ {
alias /var/run/acme/acme-challenge/;
}
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html/g.com/public_html$fastcgi_script_name;
}
}
/etc/nginx/sites-available/m.com
server {
listen 80;
listen [::]:80;
server_name m.com www.m.com;
include snippets/expires-headers.conf;
root /var/www/html/m.com/public_html;
index index.php;
access_log /var/log/nginx/m.com/www-access.log;
error_log /var/log/nginx/m.com/www-error.log error;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/html/m.com/public_html$fastcgi_script_name;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
There seems to be nothing wrong with your config, but my suspicion is that you created the config for d.com by copy/pasting the config from m.com and saved the file before making any changes and then either NGINX restarted or reloaded its configuration before you made your modifications to d.com config, which basically means that NGINX doesn't have your current configuration loaded.
You could reload the configuration. On Ubuntu/Debian is something like this:
sudo service nginx reload
You should also recheck and be absolutely sure that /var/www/html/d.com/public_html and /var/www/html/m.com/public_html are indeed serving different content.
After moving the DNS Zone file from Media Temple to Linode, http://www.d.com started loading the WordPress install from the correct folder, though http://d.com did not.
I tried another browser and found that in the other browser both were now working.
I don't understand why moving the DNS Zone file worked here.
I cannot access my site anymore using the ip address (or domain name). It always 404 Not Found I use Laravel Forge with Digital Ocean with Ubuntu 14.04.
Here's my sites-enabled/default nginx file
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/default/before/*; #That directory is empty
server {
listen 80;
server_name default;
root /home/forge/default/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/default/server/*; #That directory is empty
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/default.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/default/after/*; #That directory is empty
nginx.conf (Without commented lines)
user forge;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
On sudo service nginx restart my nginx/error.log only contains:
2016/03/24 15:25:07 [notice] 8416#0: signal process started
My nginx/default.log is empty.
Any clue of what I could look into?
It doesn't look like you defined the default server correctly - as per the Nginx docs, it should be
server {
listen 80 default_server;
server_name _; # This is just an invalid value which will never trigger on a real hostname.
...
}
Note the listen 80 default_server; in particular