Reputation: 23
I use NGINX and MariaDB on my web server.
I upgraded OS from Debian Squeeze to Debian Wheezy. After this operation I have removed Apache server and Mysql completely. Then, I have installed Nginx and MariaDB.
Now, I access my website through IP address, but I can not access it from domain name. I tried to fix it but I couldn't be successful.
My domain: http://tinyurl.com/lg4kjsg
Domain IP: 37.148.208.85
etc/nginx/nginx.conf
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
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/*;
}
etc/nginx/sites-available/default
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www/virtual;
index index.html index.htm index.php;
server_name localhost;
location / {
try_files $uri $uri/ /index.html;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
etc/nginx/sites-available/mydomain
server {
listen 80;
server_name www.mydomain.com mydomain.com;
access_log /var/www/virtual/mydomain.com/logs/access.log;
error_log /var/www/virtual/mydomain.com/logs/error.log;
location / {
root /var/www/virtual/mydomain.coom/htdocs;
index index.php index.html index.htm;
if (-f $request_filename) {
expires 30d;
break;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~ .php$ {
try_files $uri =404; #to prevent zero day exploitsts
fastcgi_pass localhost:9000; # port where FastCGI processes were spawned
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/virtual/mydomain.com/htdocs/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
}
}
etc/hosts
127.0.0.1 localhost
# nginx virtual hosts
37.148.208.85 www.mydomain.com mydomain.com
etc/resolv.conf
search domain.name
nameserver 89.19.21.250
nameserver 89.19.21.251
Any solutions/suggestions would be appreciated! Thanks.
Upvotes: 1
Views: 3128
Reputation: 23
I have solved my problem after editing this file;
etc/bind/named.conf.local I found this file on my old backup. I have added these lines and my problem fixed.
// [gencharitaci.net] entry BEGIN
zone "gencharitaci.net" {
type master;
file "/var/cache/bind/gencharitaci.net.db";
allow-transfer { localhost; };
notify yes;
};
// [gencharitaci.net] entry ENDING
// [gencharitaci.com] entry BEGIN
zone "gencharitaci.com" {
type master;
file "/var/cache/bind/gencharitaci.com.db";
allow-transfer { localhost; };
notify yes;
};
// [gencharitaci.com] entry ENDING
// [gencharitaci.org] entry BEGIN
zone "gencharitaci.org" {
type master;
file "/var/cache/bind/gencharitaci.org.db";
allow-transfer { localhost; };
notify yes;
};
// [gencharitaci.org] entry ENDING
// [admin.0050569fc491.gencharitaci.net] entry BEGIN
zone "admin.0050569fc491.gencharitaci.net" {
type master;
file "/var/cache/bind/admin.0050569fc491.gencharitaci.net.db";
allow-transfer { localhost; };
notify yes;
};
// [admin.0050569fc491.gencharitaci.net] entry ENDING
Upvotes: 1
Reputation: 399
It looks like your domain ge***.net is not registered in DNS yet.
[root@ ~]# ping gencharitaci.net
ping: unknown host gencharitaci.net
[root@ ~]# dig gencharitaci.net
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> gencharitaci.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 15999
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;gencharitaci.net. IN A
;; Query time: 103 msec
;; SERVER: 10.0.80.11#53(10.0.80.11)
;; WHEN: Wed Nov 5 07:21:50 2014
;; MSG SIZE rcvd: 34
Upvotes: 1