タイトルの通りです。
/etc/nginx/conf.d/default.conf
に設定を書き込むということで、以下のようにしました。
default.conf
1server{ 2 listen 80; 3 server_name localhost; 4 location / { 5 index index.php; 6 root /home/username/example.jp; 7 } 8} 9 10
home/username/example.jp/
をドキュメントルートにしたい(中にはindex.htmlがある)のですが、うまくいきません。
Welcome to Nginx のページが表示されます。
nginx -t
ではエラーは出ていません。
またKUSANAGIでwordpressをインストールして運用していきたいのですが、
KUSANAGIをインストールしており、kusanagi provision html
のようにするとwordpressのディレクトリを作ってくれるようですが、Nginx側で、そのディレクトリをバーチャルホストで指定しないと接続できないという認識なのですが正しいでしょうか。
まだ空のドメインを持っていないのでバーチャルホストの設定確認はできませんが、サーバーのIPにブラウザで接続したときに、指定のディレクトリのindex.html / index.php を表示したいのですが、どのようにすればできるでしょうか?
至らぬ点はサーバー初心者故、ご容赦ください。
追記
// nginx.conf
## nginx.conf user httpd www; worker_processes auto; worker_rlimit_nofile 20000; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 4096; multi_accept on; use epoll; } http { server_tokens off; include /etc/nginx/mime.types; default_type application/octet-stream; charset UTF-8; server_names_hash_bucket_size 128; log_format main '$request_time $sent_http_x_f_cache $sent_http_x_b_cache ' '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; client_max_body_size 20M; client_body_buffer_size 768k; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 5; connection_pool_size 1024; request_pool_size 8k; gzip on; gzip_http_version 1.0; gzip_disable "msie6"; gzip_proxied any; gzip_min_length 1024; gzip_comp_level 2; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/json; brotli on; brotli_static on; brotli_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/json; brotli_comp_level 3; brotli_min_length 1024; open_file_cache max=100000 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 2; open_file_cache_errors on; fastcgi_cache_path /var/cache/nginx/wordpress levels=1:2 keys_zone=wpcache:30m max_size=512M inactive=600m; fastcgi_ignore_headers "Vary" "Cache-Control" "Expires"; include /etc/nginx/conf.d/*.conf; }
回答1件
あなたの回答
tips
プレビュー