如何在本地ubuntu14.04上使用域名设置服务器?

时间:2016-07-01 11:15:18

标签: ubuntu lamp vhosts

如何在指示灯上的本地计算机上设置域名

2 个答案:

答案 0 :(得分:1)

步骤: 1.复制 CREATE TABLE booking( system_name VARCHAR2( 10 ) , start_date DATE , end_date DATE ); INSERT INTO booking( system_name, start_date, end_date ) VALUES ( 'DEMO001' , TO_DATE( '2016-09-05', 'YYYY-MM-DD' ) , TO_DATE( '2016-09-08', 'YYYY-MM-DD' ) ); -- You only need this record, as you need to filter on the system name anyway COMMIT; SELECT CASE COUNT( 1 ) WHEN 0 THEN 'I can allow' ELSE 'I cannot allow' END AS outcome FROM DUAL WHERE EXISTS (SELECT 1 FROM booking old WHERE old.system_name = 'DEMO001' AND old.end_date > TO_DATE( '2016-08-08', 'YYYY-MM-DD' ) AND old.start_date < TO_DATE( '2016-08-08', 'YYYY-MM-DD' )); SELECT CASE COUNT( 1 ) WHEN 0 THEN 'I can allow' ELSE 'I cannot allow' END AS outcome FROM DUAL WHERE EXISTS (SELECT 1 FROM booking old WHERE old.system_name = 'DEMO001' AND old.end_date > TO_DATE( '2016-08-11', 'YYYY-MM-DD' ) AND old.start_date < TO_DATE( '2016-09-08', 'YYYY-MM-DD' )); SELECT CASE COUNT( 1 ) WHEN 0 THEN 'I can allow' ELSE 'I cannot allow' END AS outcome FROM DUAL WHERE EXISTS (SELECT 1 FROM booking old WHERE old.system_name = 'DEMO001' AND old.end_date > TO_DATE( '2016-08-10', 'YYYY-MM-DD' ) AND old.start_date < TO_DATE( '2016-08-15', 'YYYY-MM-DD' )); SELECT CASE COUNT( 1 ) WHEN 0 THEN 'I can allow' ELSE 'I cannot allow' END AS outcome FROM DUAL WHERE EXISTS (SELECT 1 FROM booking old WHERE old.system_name = 'DEMO001' AND old.end_date > TO_DATE( '2016-08-10', 'YYYY-MM-DD' ) AND old.start_date < TO_DATE( '2016-09-06', 'YYYY-MM-DD' )); 2.编辑yourdoamin.conf: sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/yourdomain.conf 3.配置DomainName和IP地址:

sudo gedit  /etc/apache2/sites-available/yourdomain.conf

保存并退出。 4.进入主机文件编辑:

   <VirtualHost 12.0.0.12:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@yourdoamin.com
    ServerName www.yourdomain.com
    DocumentRoot /var/www/html/yourprojectroot

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

保存并退出。

5.启用yourdoamin.conf:

sudo gedit /etc/hosts
127.0.0.1   localhost
127.0.1.1   pramodkharade-desktop
127.0.0.12 www.yourdomain.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

6。重启apache:

sudo service apache2 restart

  1. 转到浏览器并输入yourdoamin.com并按Enter

答案 1 :(得分:0)