Nginx shows welcome page, its picking up from
/usr/share/nginx/html
But not from:
/home/nginx/domains/XYZDomain.com/public/
In Directory:
/etc/nginx/conf.d
2 Configurations Files:
default.conf
virtual.conf
default.conf file output
# Main Local
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
#
location ~ \.php$ {
include fastcgi_params;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
}
virtual.conf file output:
server {
listen 80;
server_name www.XYZDomain.com;
rewrite ^/(.*) http://XYZDomain.com/$1 permanent;
location / {
root /home/nginx/domains/XYZDomain.com/public/;
index index.html;
}
}
nginx.conf file in /etc/nginx/nginx.conf output
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
All Directories with permissions.
ls -la /home/nginx/domains/XYZDomain.com
drwxr-s--- 6 root root 4096 Jul 1 12:54 .
drwxr-xr-x 3 root root 4096 Jul 2 14:44 ..
drwxr-s--- 2 root root 4096 Jun 30 15:58 backup
drwxr-s--- 2 root root 4096 Jun 30 15:58 log
drwxr-s--- 2 root root 4096 Jun 30 15:58 private
drwxr-sr-x 2 root root 4096 Jul 2 15:01 public
I have tried modifying default.php and virtual.conf file
Can Anyone can help me what’s wrong in this? I am really confused and have wasted a whole day on this. I did reviewd other similar questions, google, etc… but this seems weird.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This question was answered by @noors:
setenforce: SELinux is disabled Still, its behaving same.
Update:
Bobby, I transferred all the domain files into
/var/www/html/DOMAIN.com/publicand changed .conf file root directory accordingly.
Now it is working fine. Is there anything else, I can/should/must do?
Thanks for everything.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.