web admin noob - 在尝试安装jenkins

时间:2016-05-30 15:18:56

标签: apache ubuntu web jenkins

我在尝试安装jenkins时破坏了我的本地开发Web服务器。詹金斯的作品。但是我已经构建并用于在我的Web服务器上访问的其他站点不起作用。 我正在关注这篇文章:https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu

按照主要部分下载并安装jenkins后,我运行了“为端口80设置Apache代理 - > 8080”部分中的步骤。 那是我成功打破阿帕奇的时候。

以下是我跑步的历史:

me@mydevbox:~$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-4.2.0-34-generic linux-image-extra-4.2.0-34-generic
  python-support
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  daemon
The following NEW packages will be installed:
  daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 8 not upgraded.
Need to get 64.0 MB of archives.
After this operation, 65.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ wily/universe daemon amd64 0.6.4-1 [98.2 kB]
Get:2 http://pkg.jenkins-ci.org/debian-stable/ binary/ jenkins 1.651.2 [63.9 MB]
Fetched 64.0 MB in 6s (9,372 kB/s)                                             
Selecting previously unselected package daemon.
(Reading database ... 433471 files and directories currently installed.)
Preparing to unpack .../daemon_0.6.4-1_amd64.deb ...
Unpacking daemon (0.6.4-1) ...
Selecting previously unselected package jenkins.
Preparing to unpack .../jenkins_1.651.2_all.deb ...
Unpacking jenkins (1.651.2) ...
Processing triggers for man-db (2.7.4-1) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up daemon (0.6.4-1) ...
Setting up jenkins (1.651.2) ...
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
[ ok ] Starting jenkins (via systemctl): jenkins.service.
ln: failed to create symbolic link ‘/run/openrc/started/jenkins’: No such file or directory
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ureadahead (0.100.0-19) ...

me@mydevbox:~$ sudo /etc/init.d/jenkins start
[ ok ] Starting jenkins (via systemctl): jenkins.service.
me@mydevbox:~$ sudo vim /etc/default/jenkins 
me@mydevbox:~$ /etc/init.d/jenkins restart
[ ok ] Restarting jenkins (via systemctl): jenkins.service.
me@mydevbox:~$ 

这是我为jenkins配置文件中的HTTP端口指定的内容:

# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8080

之后,我跑了这个:

me@mydevbox:~$ sudo a2enmod proxy
Enabling module proxy.
To activate the new configuration, you need to run:
  service apache2 restart
me@mydevbox:~$ sudo a2enmod proxy_http
Considering dependency proxy for proxy_http:
Module proxy already enabled
Enabling module proxy_http.
To activate the new configuration, you need to run:
  service apache2 restart
me@mydevbox:~$ service apache2 restart
me@mydevbox:~$ sudo a2dissite default
ERROR: Site default does not exist!
me@mydevbox:~$ sudo a2dissite 000-default
Site 000-default disabled.
To activate the new configuration, you need to run:
  service apache2 reload
 me@mydevbox:~$ service apache2 reload

然后我在/ etc / apache2 / sites-available /中创建了一个jenkins.conf文件 那个文件看起来像这样:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName ci.company.com
    ServerAlias ci
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPreserveHost on
    ProxyPass / http://localhost:8080/ nocanon
    AllowEncodedSlashes NoDecode
</VirtualHost>

此时,我试图跑:

http://localhost:8080/

启动詹金斯。

但是我不能再运行我发布的其他网站了:

localhost/mytestapp

我得到的错误是:

  

HTTP错误404

     

访问/ mytestapp /时出现问题。原因是:

Not Found

在尝试安装Jenkins之前,我刚刚安装了apache2并保留了所有默认设置。我只想在/ var / www / html下创建文件夹,它们会“神奇地”出现在我的浏览器中。

对不起,不好意思。但任何帮助将不胜感激。

编辑1

我认为我的问题与此有关:

 me@mydevbox:~$ sudo a2dissite 000-default
 Site 000-default disabled.

我之前从未注意到输出。当我检查该文件时,看起来这就是我原来的骗局。

以下是我在sites-available文件夹中的内容:

me@mydev:/etc/apache2/sites-available$ ls -lah
total 24K
drwxr-xr-x 2 root root 4.0K May 30 11:06 .
drwxr-xr-x 8 root root 4.0K Apr 19 15:18 ..
-rw-r--r-- 1 root root 1.5K Apr 19 15:30 000-default.conf
-rw-r--r-- 1 root root 6.3K Jan  7  2014 default-ssl.conf
-rw-r--r-- 1 root root  282 May 30 11:06 jenkins.conf
me@mydev:/etc/apache2/sites-available$ 

所以我想我需要一种方法来重新启用000-default.conf并且只需为jenkins添加一个条目以使用端口8080或类似的东西。 谷歌搜索的例子,但同时,如果你有任何建议,我会感激他们。

感谢。

1 个答案:

答案 0 :(得分:0)

我运行以下命令来启用这两个站点:

me@mydev:/etc/apache2$ sudo a2ensite 000-default
Enabling site 000-default.
To activate the new configuration, you need to run:
  service apache2 reload
me@mydev:/etc/apache2$ service apache2 reload
me@mydev:/etc/apache2$ cd sites-enabled/
me@mydev:/etc/apache2/sites-enabled$ ls
000-default.conf  jenkins.conf