我最近购买了DigitalOcean账户,正在尝试设置我的网站。但是,每当我输入我的网站IP地址时,会出现以下页面:
欢迎使用nginx!
如果您看到此页面,则说明nginx Web服务器已成功安装并运行。需要进行进一步的配置。
请参阅nginx.org获取在线文档和支持。nginx.com提供商业支持。
谢谢您使用nginx。
我已经搜索了答案,但没有找到适合我的内容。我正在运行Ubuntu LEMP 14.04,并使用一键安装。我计划将我的页面/文件放入"usr/share/nginx/html"文件夹中,我已经将其声明为根目录。
以下是"etc/nginx/available-sites/default.conf"文件,希望可以满足这个需求:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost unaviamedia.ca;
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
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
.........
}
然而,当我通过IP访问我的网站时,仍然只能看到Nginx欢迎页面,这让我很烦恼。如何展示主页?
编辑:更新了代码以匹配我的最新尝试。另外,对于那些想知道的人,我已经多次重启了nginx。
如果需要添加其他内容,请告诉我。谢谢!