我在我的网络服务器上使用NGINX和MariaDB。网站是通过IP地址访问,但不是域名?
我将操作系统从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/;
}
}
}
}
etc/hosts中
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
任何解决方案/建议将不胜感激!谢谢。
我该如何解决这个问题? – YoungS 2014-11-05 08:30:33
我得到了这些结果'[root @〜]#ping gencharitaci.net来自www.gencharitaci.net的64字节(37.148.208.85):icmp_req = 76 ttl = 64 time = 0.055 ms'[root @〜]#dig gencharitaci .net v; <<>> DiG 9.8.4-rpz2 + rl005.12-P1 <<>> gencharitaci.net ;;全局选项:+ cmd ;;连接超时;没有服务器无法到达 – YoungS 2014-11-05 08:36:51
谁是你的提供者?请在那里配置您的域名服务器。 如果您的域位于/ etc/hosts或/ etc/sysconfig/network中,那么您的ping可以工作,因此它在本地解析。 – 2014-11-05 08:42:30