116480
Goto Top

Vhost nimmt im Cent OS7 gar nicht ab

Hallo,

ich habe im /Var/vhost/Upload/html ein VHost Web

Nun ist die Config für VHost im /etc/https/conf.d/Upload.conf

<VirtualHost *:80>
    ServerAdmin support@xxx.ch
    DocumentRoot /var/vhost/upload/html
    ServerName upload2.xxx.ch
    ErrorLog /var/vhost/upload/logs/error_log
    CustomLog /var/vhost/upload/logs/access_log common
    ScriptAlias /cgi-bin/ "/var/vhost/upload/cgi-bin/"  
    <Directory "/var/vhost/upload/html">  
        AllowOverride All
    </Directory>
</VirtualHost>

<VirtualHost 192.168.47.237:443>
    ServerAdmin support@xxx.ch
    DocumentRoot /var/vhost/upload/html
    ServerName upload2.xxx.ch
    ErrorLog /var/vhost/upload/logs/ssl_error_log
    CustomLog /var/vhost/upload/logs/ssl_access_log common
    ScriptAlias /cgi-bin/ "/var/vhost/upload/cgi-bin/"  
    <Directory "/var/vhost/upload/html">  
        AllowOverride All
    </Directory>

    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/pki/tls/certs/wild_xxx_ch_2016_12_11.nokey.pem
    SSLCertificateKeyFile /etc/pki/tls/certs/wild_xxx_ch_2016_12_11.key
    SSLCACertificateFile /etc/pki/tls/certs/Thawte_SSL_CA_Bundle2.pem
</VirtualHost>

Ping auf upload2.xxx.ch geht Einwandfrei ! Aber Webseite geht nicht auf !

Rufe ich "Service https Status" auf erscheint

Redirecting to /bin/systemctl status http.service
â http.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)


Gruss
Ralf

Content-Key: 298169

Url: https://administrator.de/contentid/298169

Printed on: April 18, 2024 at 01:04 o'clock

Member: SlainteMhath
SlainteMhath Mar 04, 2016 at 10:47:13 (UTC)
Goto Top
Moin,

na, war's doch nicht so toll mit dem Restore, hm? face-smile

- Warum ist den Port 80 an * gebunden und Port 443 an eine einzelne IP? Absicht?
- Wird denn ein nslookup auf upload2...ch korrekt aufgelöst (ping taugt nicht zum check der Namensauflösung)
- Was steht denn in den Logfiles des vhosts?

lg,
Slainte
Mitglied: 119944
119944 Mar 04, 2016 at 10:49:40 (UTC)
Goto Top
Rufe ich "Service https Status" auf erscheint

Redirecting to /bin/systemctl status http.service
â http.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Dann gib im Terminal folgendes ein um den Apache zu starten:
systemctl start http.service


VG
Val
Member: michi1983
michi1983 Mar 04, 2016 updated at 12:02:47 (UTC)
Goto Top
Zitat von @119944:
Dann gib im Terminal folgendes ein um den Apache zu starten:
systemctl start http.service
Das wurde ihm in den lezten 2 Threads ja noch nicht verraten face-wink
Mitglied: 119944
119944 Mar 04, 2016 at 12:01:52 (UTC)
Goto Top
Ok bei der Vorgeschichte hat der Kollege offenbar noch ganz andere Probleme...
Mitglied: 114757
114757 Mar 04, 2016 updated at 22:14:29 (UTC)
Goto Top
Moin,
wenn du deine VHosts in ein anderes Verzeichnis als /var/www/ verschiebst muss man die SELinux-Policies unter CentOS anpassen das ist dir schon klar ? Vermutlich nicht ...
http://www.serverlab.ca/tutorials/linux/web-servers-linux/configuring-s ...
Das lässt sich zwar temporär mit setenforce 0 deaktivieren sollte man aber nicht machen.

Gruß jodel32
Mitglied: 117471
117471 Mar 05, 2016 at 09:10:59 (UTC)
Goto Top
Mist.

Jodel32 ist mir zuvorgekommen face-sad
Mitglied: 116480
116480 Mar 07, 2016 at 06:50:39 (UTC)
Goto Top
Hallo,

also bei

[root@obtweb01 ~]# systemctl start http.service
Failed to start http.service: Unit http.service failed to load: No such file or directory.


Gruss
Ralf
Member: michi1983
michi1983 Mar 07, 2016 at 06:58:04 (UTC)
Goto Top
<offtopic>Neue Kommentarfunktion? face-smile Sehr hübsch!</offtopic>

Zitat von @116480:
[root@obtweb01 ~]# systemctl start http.service
Failed to start http.service: Unit http.service failed to load: No such file or directory.
Versuch es mal mit
systemctl start httpd.service
und wenn du möchtest, dass das auch einen Reboot überlebt danach ein
systemctl enable httpd.service
Gruß
Mitglied: 116480
116480 Mar 07, 2016 at 07:09:31 (UTC)
Goto Top
hAllo,¨

der startet erst gar nicht, es kommt:

[root@1 ~]# systemctl start httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

Dann
[root@1 ~]# systemctl status httpd.service
â httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2016-03-07 08:07:11 CET; 1min 53s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 11261 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 11260 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 11260 (code=exited, status=1/FAILURE)

Mär 07 08:07:11 1.domain.local systemd[1]: Starting The Apache HTTP Server...
Mär 07 08:07:11 1.domain.local httpd[11260]: [Mon Mar 07 08:07:11.830916 2016] [so:warn] [pid 11260] AH01574: module php5_module is already loaded, skipping
Mär 07 08:07:11 1.domain.local httpd[11260]: httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/1.conf: /etc/httpd/conf.d/1.conf...s not closed.
Mär 07 08:07:11 1.domain.local systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mär 07 08:07:11 1.domain.local kill[11261]: kill: cannot find process ""
Mär 07 08:07:11 1.domain.local systemd[1]: httpd.service: control process exited, code=exited status=1
Mär 07 08:07:11 1.domain.local systemd[1]: Failed to start The Apache HTTP Server.
Mär 07 08:07:11 1.domain.local systemd[1]: Unit httpd.service entered failed state.
Mär 07 08:07:11 1.domain.local systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

Gruss
Ralf
Mitglied: 117471
117471 Mar 07, 2016 at 07:15:22 (UTC)
Goto Top
Schon mal neu gestartet?
Member: michi1983
michi1983 Mar 07, 2016 at 07:15:44 (UTC)
Goto Top
Zitat von @116480:
Mär 07 08:07:11 domain.local httpd[11260]: httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/obt.conf: /etc/httpd/conf.d/obt.conf...s not closed.
Und verrätst du uns auch was in dieser Zeile in deiner Config steht?
Mitglied: 116480
116480 Mar 07, 2016 at 07:28:40 (UTC)
Goto Top
Hallo,

da steht nun:

<VirtualHost 192.168.47.237:80>
    ServerAdmin support@domain.tld
    DocumentRoot /var/vhost/upload/html
    ServerName upload2.domain.tld
    ErrorLog /var/vhost/upload/logs/ssl_error_log
    CustomLog /var/vhost/upload/logs/ssl_access_log common
    ScriptAlias /cgi-bin/ "/var/vhost/upload/cgi-bin/"  
    <Directory "/var/vhost/upload/html">  
        AllowOverride All
    </Directory>


#    SSLEngine on
#    SSLProtocol all -SSLv2
#    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
#    SSLCertificateFile /etc/pki/tls/certs/wild_domain_tld_2016_12_11.nokey.pem
#    SSLCertificateKeyFile /etc/pki/tls/certs/wild_domain_tld_2016_12_11.key
#    SSLCACertificateFile /etc/pki/tls/certs/Thawte_SSL_CA_Bundle2.pem
</VirtualHost>

Nun kommt : [root@local ~]# systemctl status httpd.service
â httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2016-03-07 08:21:01 CET; 5min ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 10179 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 10001 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 10001 (code=exited, status=1/FAILURE)

Mär 07 08:21:01 domain.local systemd[1]: Starting The Apache HTTP Server...
Mär 07 08:21:01 domain.local httpd[10001]: [Mon Mar 07 08:21:01.453644 2016] [so:warn] [pid 10001] AH01574: module php5_module is already loaded, skipping
Mär 07 08:21:01 domain.local systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mär 07 08:21:01 domain.local kill[10179]: kill: cannot find process ""
Mär 07 08:21:01 domain.local systemd[1]: httpd.service: control process exited, code=exited status=1
Mär 07 08:21:01 domain.local systemd[1]: Failed to start The Apache HTTP Server.
Mär 07 08:21:01 domain.local systemd[1]: Unit httpd.service entered failed state.
Mär 07 08:21:01 domain.local systemd[1]: httpd.service failed.


Gruss
Ralf
Mitglied: 114757
114757 Mar 07, 2016 updated at 08:13:28 (UTC)
Goto Top
Ich würde vorschlagen die Config zu bereinigen oder erst mal auf Default zurückzusetzen und dann den Apache noch mal über yum neu zu installieren und dann Schritt für Schritt die Config wieder anpassen mit dazwischenliegenden Neustarts des httpd Dienstes.
Ganz klar und einfach umzusetzen. Strukturiert arbeiten lautet hier die Devise.

Aber so wie ich unseren Pappenheimer itworld kenne war es zum Schluss doch wieder irgendein Flüchtigkeits- oder Tippfehler.

Wie so oft. Also wartet einfach mal etwas face-wink dann löst sich das Problem bei Ihm meist von selbst. Seine Problem sind meistens Hausgemacht face-smile
Mitglied: 116480
116480 Mar 07, 2016 at 09:08:09 (UTC)
Goto Top
Hallo,

habe mal Apache neu installiert. Di VHost .conf Datei entfernt und Web ins Standardverzeichnis wieder kopiert.
Web lauft mal so. Aber ich bekomme das nicht als VHost zum laufen.

Gruss
Ralf
Mitglied: 116480
116480 Mar 17, 2016 at 11:49:17 (UTC)
Goto Top
Die Frage ist, wie bringt man dem Host nun bei , das er das Vhost kennt ?

Gruss
Ralf
Mitglied: 116480
116480 Mar 17, 2016 at 11:57:18 (UTC)
Goto Top
Laut dem hier sind Vhost nicht aktiv

https://wiki.ubuntuusers.de/Apache/Virtual_Hosts/

Man muss die erst aktivieren !
Wie hier sudo a2ensite MEIN_VHOST.conf
Wie ist Befehlt bei Cent OS ?

Gruss
Ralf
Mitglied: 116480
116480 Mar 17, 2016 at 12:41:19 (UTC)
Goto Top
Habe nun Web neu eingerichtet.
Nun kommt
[Thu Mar 17 13:37:45.333760 2016] [authz_core:error] [pid 11065] [client 172.23.20.214:62161] AH01630: client denied by server configuration: /var/vhost/upload/html

Seite zeigt die Anzeige zur Ablehung an. Eingerichtet nach :

http://dokuwiki.nausch.org/doku.php/centos:web_c7:apache_1

Gruss
Rlaf
Mitglied: 117471
117471 Mar 17, 2016 at 13:54:36 (UTC)
Goto Top
Du hast schon wieder einen Pfad ungleich dem vom System vorgegebenen Pfad benutzt.

Wie hast Du denn das SELinux auf dem pfad konfiguriert?
Member: SlainteMhath
SlainteMhath Mar 17, 2016 at 14:00:28 (UTC)
Goto Top
Seite zeigt die Anzeige zur Ablehung an
404? 403? 500?

Verwendest du immer noch Location Direktiven ohne
  Order allow, deny
  Allow from all
?
Mitglied: 114757
Solution 114757 Mar 18, 2016 updated at 09:55:16 (UTC)
Goto Top
Zitat von @116480:

Die Frage ist, wie bringt man dem Host nun bei , das er das Vhost kennt ?
Durch die normale Config, also entweder direkt in der httpd.conf oder in einer extra erstellen Config unter /etc/httpd/conf.d/<deineconf>.conf
Laut dem hier sind Vhost nicht aktiv
https://wiki.ubuntuusers.de/Apache/Virtual_Hosts/
Man muss die erst aktivieren !
NEIN definitiv nicht, die richtige VHost-Config reicht unter CentOS!

Ich verstehe nicht was du an der vorgehensweise unter dem oben gesposteten Link nicht verstehst??
http://www.serverlab.ca/tutorials/linux/web-servers-linux/configuring-s ...

Da steht doch ganz klar wie du eine Policy für dein neues Webroot anlegst (Abschnitt Create the Policies)
Die Objects des Apache heißen
  • httpd_sys_content_t (für den einfachen Lesezugriff des Apache)
  • httpd_sys_rw_content_t (für Schreibzugriff für den Apache)
  • httpd_log_t (Zugriff für den Log-Daemon des Apache)
  • usw.

Ein
semanage fcontext -l | grep /var/www
zeigt dir wie die Rechte auf /var/www gesetzt wurden, danach kannst du dich richten und die Rechte für dein neues VHost-Root (var/vhost) und die Log-Verzeichnisse deines VHosts auch entsprechend beschreibbar setzen.

Die Angabe des Pfades erfolgt hier in Regular-Expressions-Syntax, das (/.*)? am Ende einer Regel bedeutet hier also das alle nachfolgende Verzeichnisse ebenfalls durch diese Regel erfasst werden.

Also, man muss die Artikel einfach nur in Ruhe lesen dann ist das alles kein Hexenwerk, min Jung!

Gruß jodel32
Mitglied: 117471
117471 Mar 18, 2016 at 10:35:44 (UTC)
Goto Top
Naja.

Den Krempel mit dem SELinux erzählen wir schon seit zwei Wochen. Es scheint kein Wille da zu sein, sich eingehend damit zu beschäftigen. Statt dessen werden offenbar "nur" Konfigurationsbeispiele gelesen und es wird versucht, daraus die Logik eines funktionierenden Webservers abzuleiten.

Lange Rede, kurzer Sinn: Ich bin raus... face-smile
Mitglied: 114757
114757 Mar 18, 2016 updated at 10:38:08 (UTC)
Goto Top
Zitat von @117471:
Es scheint kein Wille da zu sein, sich eingehend damit zu beschäftigen.
Man braucht sich nur mal seine anderen Threads anschauen ...
Lange Rede, kurzer Sinn: Ich bin raus... face-smile
mee too. Ist ja jetzt alles gesagt.
Mitglied: 116480
116480 Mar 22, 2016 at 19:33:14 (UTC)
Goto Top
Hallo,

also das mit dem SELINUX ist wohl nur ein kleines Verständnisproblem
Ich gebe ein
semanage fcontext -a -t http_sys_content_t "/VHost.*)?"
anstatt
semanage fcontext -a -t http_sys_content_t "/webapps(/.*)?"
Dann kommt :

[root@local ~]# semanage fcontext -a -t http_sys_content_t "/vhost(/.*)?"
ValueError: http_sys_content_t-Typ ist ungültig, dies muss eine Datei oder ein Gerätetyp sein

Gruss
Ralf
Mitglied: 117471
117471 Mar 22, 2016 at 19:37:56 (UTC)
Goto Top
Ich würde mal im Standard-Ordner gucken, wie der Kontext genau heißt.

IMO kann man das mit "ls -Z" oder "ls -z" anzeigen...
Mitglied: 114757
114757 Mar 23, 2016 updated at 09:54:50 (UTC)
Goto Top
httpd_sys_content_t
Mal wieder typisch Ralf ....

Tippfehler, dir fehlt ein d!

Ich gebe ein
semanage fcontext -a -t http_sys_content_t "/VHost.*)?"
Und hier fehlt zusätzlich noch die öffnende Klammer etc. im Regex Ausdruck X)

Linux erfordert PRÄZISION falls dir das noch nicht aufgefallen ist!
sudo semanage fcontext -a -t httpd_sys_content_t "/vhost(/.*)?"
Mitglied: 116480
116480 Mar 23, 2016 at 10:05:57 (UTC)
Goto Top
nun haben die Commands funktioniert.
Lade eben noch das Web hoch. dann mal schauen-.

[root@local ~]# sudo semanage fcontext -a -t httpd_sys_content_t "/vhost(/.*)?"
[root@local ~]# sudo semanage fcontext -a -t httpd_sys_content_t "/var/vhost(/.*)?"
[root@local ~]# sudo semanage fcontext -a -t httpd_log_t "/var/vhost/logs(/.*)?"
[root@local ~]# sudo semanage fcontext -a -t httpd_cache_t "/var/vhost/cache(/.*)?"


Gruss
Ralf
Mitglied: 116480
116480 Apr 14, 2016 at 11:54:54 (UTC)
Goto Top
Hallo,

wichtig ist, das man den Context setzt.
Richtig in dem Fall
chcon -R -t httpd_sys_content_t /var/vhost/*/html
chcon –R –t httpd_log_t /var/vhost/*/logs

Man muss aber unter httpd/conf.d/ noch das conf anpassen mit diesen Zeilen:
<Directory "/var/vhost/upload/html">
AllowOverride All
Require all granted
Allow from all
</Directory>


Dann wurde noch SSL installiert

gruss
rAlf