0

我使用 apache(端口 8000)和 nginx(端口 80)来提供静态文件。现在我在 sitemap.xml 文件中看到了这样的网址:

http://mysite:8000/slug

无法弄清楚为什么我会得到它,因为在其他网站上我对 apache 和 nginx 使用几乎相同的配置......并且站点地图代码看起来也相似。这是apache配置文件的内容:

<VirtualHost *:8000>
    ServerName mysite
    ServerAlias www.mysite

    DocumentRoot /var/www/mysite

    WSGIProcessGroup mysite
        WSGIScriptAlias / /var/www/mysite/myapp/wsgi.py
        WSGIDaemonProcess mysite \
                python-path=/home/dmitry/.virtualenv/myapp/lib/python2.7/site-packages 

    <Directory />
        AllowOverride None
        Order Deny,Allow
        Deny from all
        <Files robots.txt>
            Order deny,allow
            Allow from All
        </Files>
    </Directory>

    <Directory /var/www/mysite/myapp>
                <Files wsgi.py>
                Order deny,allow
                Allow from All
                </Files>
                Order deny,allow
                Deny from All
        </Directory>


    <Directory /var/www/mysite/myapp/static>
        Order deny,allow
        Allow from All
    </Directory>

    Alias /static/ /var/www/mysite/myapp/static/
    Alias /robots.txt /var/www/mysite/robots.txt

    ErrorLog ${APACHE_LOG_DIR}/mysite.error.log

    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/mysite.access.log combined

</VirtualHost>

这是nginx配置:

server{
    listen 80;
    server_name mysite www.mysite;

    root /usr/share/nginx/www;
        index index.html index.htm;

    location /static {
        alias /var/www/mysite/myapp/static;
    }

    location /media {
        alias /var/www/mysite/myapp/media;
    }

    location / {
        proxy_pass http://mysite:8000;
    }
}

这对SEO有害吗?

更新 这是我用来生成站点地图的代码:

视图.py

from django.contrib.sitemaps import Sitemap

class VideosSitemap(Sitemap):
    changefreq = 'monthly'
    priority = 0.5

    def items(self):
        return Video.objects.filter(is_published=True)

    def lastmod(self, obj):
        return obj.datetime_published

网址.py

sitemaps = {
    'videos': VideosSitemap,
}
urlpatterns = patterns('',
    ...
    url(r'^videos/sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
    ...
)
4

0 回答 0