无法访问http:// www。项目内的网站

时间:2014-06-07 00:39:21

标签: nginx configuration href

我正在开发一个网站,并且是一个新手。最近我在我的网站上添加了一个模块来访问互联网网站,例如使用href =" www.randomsite.com"来自特定的锚标签。 我无法访问href网站,并将其附加到我的项目主目录,点击链接后,它指向" localhost / www.randomsite.com"而不是纯www网站。 这里是nginx.conf,请告诉我要改变的事情以获得预期的行动。 提前谢谢。

用户html;

worker_processes 1;

error_log logs / error.log;

error_log logs / error.log notice;

error_log logs / error.log info;

pid logs / nginx.pid;

活动{

worker_connections  1024;

}

http {

include       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  logs/access.log  main;



sendfile        on;

#tcp_nopush     on;



#keepalive_timeout  0;

keepalive_timeout  65;



gzip  on;



server {

    listen       80;

    server_name  localhost;

root    /home/ranjan/public_html/socialedu/trunk;

index   index.php;



location / {

    rewrite ^ /index.php?url=$uri last;

    }



location ~* \.(jpg|jpeg|gif|css|png|js|ico|html|png|mp4|mp3|ogg)$ {

    expires max;

    add_header Pragma public;

    add_header Cache-Control "public, must-revalidate, proxy-revalidate";

}

location ~ \.php$ {

     try_files      $uri =404;

     fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;

     fastcgi_index  index.php;

     include        fastcgi.conf;

}



    access_log  logs/host.access.log  main;



    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {

        root   /usr/share/nginx/html;

    }

}

服务器{

     server_name     phpmyadmin.local;



     root    /usr/share/webapps/phpMyAdmin;

     index   index.php;



     location ~ \.php$ {

             try_files      $uri =404;

             fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;

             fastcgi_index  index.php;

             include        fastcgi.conf;

     }

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

#    listen       8000;

#    listen       somename:8080;

#    server_name  somename  alias  another.alias;



#    location / {

#        root   html;

#        index  index.html index.htm;

#    }

#}





# HTTPS server

#

#server {

#    listen       443;

#    server_name  localhost;



#    ssl                  on;

#    ssl_certificate      cert.pem;

#    ssl_certificate_key  cert.key;



#    ssl_session_timeout  5m;



#    ssl_protocols  SSLv2 SSLv3 TLSv1;

#    ssl_ciphers  HIGH:!aNULL:!MD5;

#    ssl_prefer_server_ciphers   on;



#    location / {

#        root   html;

#        index  index.html index.htm;

#    }

#}

}

1 个答案:

答案 0 :(得分:0)

这与nginx无关。您需要提供URI

<a href="http://en.wikipedia.org/wiki/Uniform_resource_identifier">Link</a>