我在我的网络服务器上使用NGINX和MariaDB。
我将操作系统从Debian Squeeze升级到Debian Wheezy。在此操作之后,我完全删除了Apache服务器和Mysql。然后,我安装了Nginx和MariaDB。
现在,我通过IP地址访问我的网站,但我无法从域名访问它。我试图解决它,但我无法成功。
我的域名:http://tinyurl.com/lg4kjsg
域名IP:37.148.208.85
等/ 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/*;
}
等/ nginx的/位点可用/默认
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;
}
}
等/ nginx的/位点可用/ 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/;
}
}
}
}
等/主机
127.0.0.1 localhost
# nginx virtual hosts
37.148.208.85 www.mydomain.com mydomain.com
等/ resolv.conf的
search domain.name
nameserver 89.19.21.250
nameserver 89.19.21.251
任何解决方案/建议将不胜感激!感谢。
答案 0 :(得分:1)
您的域名ge ***。net似乎尚未在DNS中注册。
[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
答案 1 :(得分:1)
编辑完这个文件后我解决了我的问题;
etc / bind / named.conf.local 我在旧备份中找到了这个文件。我添加了这些行,我的问题已修复。
// [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