0
我想用nginx爲我的資產文件提供服務。 ngnix服務器監聽端口如8000(它必須不同於80),我想通過子域名像assets.mydomain.com訪問這些文件。具有不同端口和子域的資產文件的Nginx配置
我嘗試配置,但我不能這樣做。我應該如何配置?謝謝你的回答。
server {
listen 8000;
server_name localhost;
location/{
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
server {
listen 8000;
server_name assets.localhost;
location /assets/ {
root /var/www/html/skytrip/assets
try_files $uri $uri/ =404;
}
}