VPS侦探论坛

 找回密码
 注册
查看: 3255|回复: 3

军哥,如何既能用ip访问网站,也能用域名访问网站呢

[复制链接]
发表于 2017-9-26 17:13:03 | 显示全部楼层 |阅读模式

当时用lnmp安装包安装的时候,只绑定了一个二级域名,现在用域名能正常访问,但是用ip访问就显示lnmp一键安装包安装成功界面,如何既能用ip访问网站,也能用域名访问呢?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2017-9-26 17:14:05 | 显示全部楼层

还是小白,望军哥详解,谢谢!



nignx.conf
server
    {
        listen 80 default_server;
        #listen [::]:80 default_server ipv6only=on;
        server_name _;
        index index.html index.htm index.php;
        root  /home/wwwroot/default;

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include enable-php.conf;

        location /nginx_status
        {
            stub_status on;
            access_log   off;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/access.log;
    }
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-9-26 17:26:08 | 显示全部楼层

还有就是phpadmin的问题


就是如何把phpadmin整个移动到根目录呢
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-9-26 19:42:08 | 显示全部楼层



直接在目录目录上建站,然后nginx.conf中改域名就同时ip和域名都是一个了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-25 07:19 , Processed in 0.035923 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表