0

tengo instalado nginx en amazon linux.. quiero cambiar la ruta a var/www/html mi configuracion es la sgte:

<h1>/etc/nginx/nginx.conf</h1>

user nginx;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 409600;

events {
worker_connections 4096;
multi_accept on;
}

http {
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
log_not_found off;
types_hash_max_size 2048;
client_max_body_size 16M;

# MIME
include mime.types;
default_type application/octet-stream;

# logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;

# load configs
include /etc/nginx/conf.d/*.conf;

# 34.219.69.153
server {
	listen 80;
	listen [::]:80;

	server_name 34.219.69.153;
	set $base /var/www/html;
	root $base/var/www/html;

	# index.php
	index index.php;

	# $uri, index.php
	location / {
		try_files $uri $uri/ /index.php?$query_string;
	}

	# security headers
	add_header X-Frame-Options "SAMEORIGIN" always;
	add_header X-XSS-Protection "1; mode=block" always;
	add_header X-Content-Type-Options "nosniff" always;
	add_header Referrer-Policy "no-referrer-when-downgrade" always;
	add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
	
	# . files
	location ~ /\. {
		deny all;
	}
	
	# assets, media
	location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
		expires 7d;
		access_log off;
	}
	
	# svg, fonts
	location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff|woff2)$ {
		add_header Access-Control-Allow-Origin "*";
		expires 7d;
		access_log off;
	}
	
	# gzip
	gzip on;
	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;

	# handle .php
	location ~ \.php$ {
		try_files $uri =404;
		
		# fastcgi
		fastcgi_pass				unix:/var/run/php5-fpm.sock;
		fastcgi_index				index.php;
		fastcgi_split_path_info		^(.+\.php)(/.+)$;
		fastcgi_param				SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param				PHP_ADMIN_VALUE open_basedir=$base/:/usr/lib/php/:/tmp/;
		fastcgi_intercept_errors	off;
		
		fastcgi_buffer_size				128k;
		fastcgi_buffers					256 16k;
		fastcgi_busy_buffers_size		256k;
		fastcgi_temp_file_write_size	256k;
		
		# default fastcgi_params
		include fastcgi_params;
	}
}

# subdomains redirect
server {
	listen 80;
	listen [::]:80;

	server_name *.34.219.69.153;

	return 301 https://34.219.69.153$request_uri;
}

}

Escribe tu comentario
+ 2
1
160725Puntos

cambia

set $base /var/www/html;
root $base/var/www/html;

Por la ruta de la carpeta donde quieres tener tu sitio.

0
28354Puntos

Basta con cambiar:
root $base/var/www/html;
por
root /var/www/html;

Sin $base

Así lo configure yo y funciona, después solo reinicia el servicio:
sudo service nginx restart