-
sadue
- Posts: 55
- Joined: 2016/01/08 19:08:26
Unable to start/restart httpd
Hey guys
I tried to restart my apache httpd afetr installing php56u from ius, and php56u-cli, but I got the following error message
~]$ sudo systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See «systemctl status httpd.s
ervice» and «journalctl -xe» for details.
Then I run the code as instructed on the error message as follows, and it generates the following message.
~]$ 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 Tue 2016-03-01 11:53:07 UTC; 15s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 28473 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 28471 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 28471 (code=exited, status=1/FAILURE)
Mar 01 11:53:07 myclasslist systemd[1]: Starting The Apache HTTP Server…
Mar 01 11:53:07 myclasslist httpd[28471]: httpd: Syntax error on line 353 of /etc/httpd/conf/httpd.conf…nfig
Mar 01 11:53:07 myclasslist systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 01 11:53:07 myclasslist kill[28473]: kill: cannot find process «»
Mar 01 11:53:07 myclasslist systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 01 11:53:07 myclasslist systemd[1]: Failed to start The Apache HTTP Server.
Mar 01 11:53:07 myclasslist systemd[1]: Unit httpd.service entered failed state.
Mar 01 11:53:07 myclasslist systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
Please guys, what should I do?
-
sadue
- Posts: 55
- Joined: 2016/01/08 19:08:26
Re: Unable to start/restart httpd
Post
by sadue » 2016/03/08 15:14:34
Okay.
I rebuild and start everything all afresh.
I now tried to enable virtualhost following the bellow procedure which is to include ssl
sudo mkdir -p /var/www/mydomain.org/htdocs
sudo chown -R apache:apache /var/www/mydomain.org/htdocs
sudo chmod -R 755 /var/www
sudo mkdir /etc/httpd/sites-available
sudo mkdir /etc/httpd/sites-enabled
sudo nano /etc/httpd/conf/httpd.conf
add the bellow code at the end of the file
IncludeOptional sites-enabled/*.conf
sudo nano /etc/httpd/sites-available/mydomain.org.conf
Add the bellow info to the file content and save
<VirtualHost 104.xxx.xxx.xxx:443>
servername www.mydomain.org
ServerAdmin serveradmin@mydomain.org
DocumentRoot «/var/www/mydomain.org/htdocs»
ServerAlias mydomain.org
ErrorLog /var/www/mydomain.org/error.log
CustomLog /var/www/mydomain.org/requests.log combined
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/mydomain_org.crt
SSLCertificateKeyFile /etc/httpd/ssl/myserver.key
SSLCertificateChainFile /etc/httpd/ssl/mydomain_org.ca-bundle
<directory «/var/www/mydomain.org/htdocs»>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
sudo ln -s /etc/httpd/sites-available/mydomain.org.conf /etc/httpd/sites-enabled/mydomain.org.conf
Now I tried to restart my apache using the bellow comand
Code: Select all
sudo systemctl restart httpd.service
but it out put the bellow info on the image
- httpd error.PNG (40.14 KiB) Viewed 278660 times
I don’t know what I have not done right. Please help me out.
-
pfr
- Posts: 13
- Joined: 2016/02/25 15:39:25
Re: Unable to start/restart httpd
Post
by pfr » 2016/03/14 15:33:25
What does «journalctl -xe» show after the failed start command?
-
sadue
- Posts: 55
- Joined: 2016/01/08 19:08:26
Re: Unable to start/restart httpd
Post
by sadue » 2016/03/16 07:36:55
pfr wrote:What does «journalctl -xe» show after the failed start command?
~]$ journalctl -xe
Mar 16 07:22:54 server.mydomain.org sudo[13517]: sadue : TTY=pts/0 ; PWD=/home/sadue ; USER=root ; COMMAND=/bin/mkdir /etc/httpd/sites-enabled
Mar 16 07:23:08 server.mydomain.org sudo[13521]: sadue : TTY=pts/0 ; PWD=/home/sadue ; USER=root ; COMMAND=/bin/nano /etc/httpd/conf/httpd.conf
Mar 16 07:23:50 server.mydomain.org sudo[13546]: sadue : TTY=pts/0 ; PWD=/home/sadue ; USER=root ; COMMAND=/bin/nano /etc/httpd/sites-available/myclasslis
Mar 16 07:24:53 server.mydomain.org sudo[13573]: sadue : TTY=pts/0 ; PWD=/home/sadue ; USER=root ; COMMAND=/bin/ln -s /etc/httpd/sites-available/myclassli
Mar 16 07:29:14 server.mydomain.org polkitd[678]: Registered Authentication Agent for unix-process:14008:124228732 (system bus name :1.1035 [/usr/bin/pkttyagent —not
Mar 16 07:29:19 server.mydomain.org polkit-agent-helper-1[14027]: pam_unix(polkit-1:auth): authentication failure; logname= uid=1000 euid=0 tty= ruser=root rhost= us
Mar 16 07:29:19 server.mydomain.org polkit-agent-helper-1[14027]: pam_succeed_if(polkit-1:auth): requirement «uid >= 1000» not met by user «root»
Mar 16 07:29:21 server.mydomain.org polkitd[678]: Operator of unix-process:14008:124228732 FAILED to authenticate to gain authorization for action org.freedesktop.sys
Mar 16 07:29:21 server.mydomain.org polkitd[678]: Unregistered Authentication Agent for unix-process:14008:124228732 (system bus name :1.1035, object path /org/freede
Mar 16 07:29:39 server.mydomain.org sudo[14048]: sadue : TTY=pts/0 ; PWD=/home/sadue ; USER=root ; COMMAND=/sbin/service apache2 restart
Mar 16 07:29:39 server.mydomain.org polkitd[678]: Registered Authentication Agent for unix-process:14049:124231256 (system bus name :1.1037 [/usr/bin/pkttyagent —not
Mar 16 07:29:39 server.mydomain.org polkitd[678]: Unregistered Authentication Agent for unix-process:14049:124231256 (system bus name :1.1037, object path /org/freede
Mar 16 07:29:40 server.mydomain.org sshd[14046]: Connection closed by 104.131.149.87 [preauth]
Mar 16 07:30:06 server.mydomain.org sudo[14065]: sadue : TTY=pts/0 ; PWD=/home/sadue ; USER=root ; COMMAND=/bin/systemctl restart httpd.service
Mar 16 07:30:06 server.mydomain.org polkitd[678]: Registered Authentication Agent for unix-process:14066:124234022 (system bus name :1.1038 [/usr/bin/pkttyagent —not
Mar 16 07:30:06 server.mydomain.org systemd[1]: Stopping The Apache HTTP Server…
— Subject: Unit httpd.service has begun shutting down
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel
—
— Unit httpd.service has begun shutting down.
Mar 16 07:30:08 server.mydomain.org systemd[1]: Starting The Apache HTTP Server…
— Subject: Unit httpd.service has begun start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel
—
— Unit httpd.service has begun starting up.
Mar 16 07:30:08 server.mydomain.org httpd[14076]: AH00112: Warning: DocumentRoot [/var/www/mydomain.org/htdocs] does not exist
Mar 16 07:30:08 server.mydomain.org systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 16 07:30:08 server.mydomain.org kill[14078]: kill: cannot find process «»
Mar 16 07:30:08 server.mydomain.org systemd[1]: httpd.service: control process exited, code=exited status=1
Mar 16 07:30:08 server.mydomain.org systemd[1]: Failed to start The Apache HTTP Server.
— Subject: Unit httpd.service has failed
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/li … temd-devel
—
— Unit httpd.service has failed.
—
— The result is failed.
Mar 16 07:30:08 server.mydomain.org systemd[1]: Unit httpd.service entered failed state.
Mar 16 07:30:08 server.mydomain.org systemd[1]: httpd.service failed.
Mar 16 07:30:08 server.mydomain.org polkitd[678]: Unregistered Authentication Agent for unix-process:14066:124234022 (system bus name :1.1038, object path /org/freede
lines 1087-1128/1128 (END)
-
pfr
- Posts: 13
- Joined: 2016/02/25 15:39:25
Re: Unable to start/restart httpd
Post
by pfr » 2016/03/16 08:27:41
Strange, just tried installing php56u here also and apache is starting and PHP is working as well.
Can you increase the loglevel to debug or trace1 in /etc/httpd/sites-available/mydomain.org.conf and /etc/httpd/conf/httpd.conf?
And post the content of /var/www/mydomain.org/error.log and /var/log/httpd/error_log, assuming that’s where the main httpd log is written?
-
sadue
- Posts: 55
- Joined: 2016/01/08 19:08:26
Re: Unable to start/restart httpd
Post
by sadue » 2016/03/17 07:01:09
Now I followed this post at digitalocean on creating virtualhost step by step https://www.digitalocean.com/community/ … n-centos-7, on restarting apache, I got this error report,
d]# apachectl restart
Job for httpd.service failed because the control process exited with error code. See «systemctl status httpd.service» and «journalctl -xe» for details.
I checked the error report and saw the bellow error
[Thu Mar 17 06:51:35.362444 2016] [mpm_prefork:notice] [pid 14624] AH00170: caught SIGWINCH, shutting down gracefully
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/mydomain.org/error.log.
AH00015: Unable to open logs
What permission does the error log requires, and which user should I assign it to.
I have created virtualhost before on a different server, and I don’t know why is becoming troublesome on this one server.
-
pfr
- Posts: 13
- Joined: 2016/02/25 15:39:25
Re: Unable to start/restart httpd
Post
by pfr » 2016/03/17 07:57:05
Ok, that explains a lot, I think this issue is caused by SELinux. I had it set to Permissive to troubleshoot another issue I have here.
Since the log dir was created under /var/www, and no specific context rule exists for /var/www/mydomain.org, it will get the same context as /var/www, which is httpd_sys_content_t:
Code: Select all
[root@server2 sites-enabled]# ls -Zd /var/www
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www
The log file dir should have httpd_log_t context:
Code: Select all
[root@server2 sites-enabled]# ls -Zd /var/log/httpd/
drwx------. root root system_u:object_r:httpd_log_t:s0 /var/log/httpd/
And the DocumentRoot /var/www/mydomain.org/htdocs should have httpd_sys_content_t.
So, to fix it:
Code: Select all
semanage fcontext -a -t httpd_sys_content_t "/var/www/mydomain.org(/.*)?"
semanage fcontext -a -t httpd_log_t "/var/www/mydomain.org/.*.log.*"
restorecon -R -v /var/www/mydomain.org
Also, I would create a separate log sub directory, to make the SELinux context less confusing.
Or you could of course set SELinux to Permissive
Last edited by pfr on 2016/03/17 08:12:57, edited 1 time in total.
-
TrevorH
- Site Admin
- Posts: 32529
- Joined: 2009/09/24 10:40:56
- Location: Brighton, UK
Re: Unable to start/restart httpd
Post
by TrevorH » 2016/03/17 08:08:31
Don’t try to write logs to /var/www. Write them to /var/log/httpd instead and then selinux will not think it is a hacker trying to break in!
-
pfr
- Posts: 13
- Joined: 2016/02/25 15:39:25
Re: Unable to start/restart httpd
Post
by pfr » 2016/03/17 08:40:41
Agreed
If you experiencing error when you’re adding a httpd conf file for your sites, specifically in /etc/httpd/sites-available directory and adding symbolic link in it. You got a problem when restarting your server from using service httpd restart command.
The error says:
Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.
And when you expand the error log, it outputs something:
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2018-04-19 17:40:30 UTC; 13s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 10706 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 10704 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 10704 (code=exited, status=1/FAILURE)
Apr 19 17:40:30 codefaq-centos-server systemd[1]: Starting The Apache HTTP Server...
Apr 19 17:40:30 codefaq-centos-server systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Apr 19 17:40:30 codefaq-centos-server kill[10706]: kill: cannot find process ""
Apr 19 17:40:30 codefaq-centos-server systemd[1]: httpd.service: control process exited, code=exited status=1
Apr 19 17:40:30 codefaq-centos-server systemd[1]: Failed to start The Apache HTTP Server.
Apr 19 17:40:30 codefaq-centos-server systemd[1]: Unit httpd.service entered failed state.
Apr 19 17:40:30 codefaq-centos-server systemd[1]: httpd.service failed.
This error occur because you’re most likely migrated into a new server that are using latest CentOS version. On the latest CentOS, putting a log inside the /var/www directory is prohibited and the server will not allow it – that’s why you’re getting this error. Instead put it in the /var/log directoryyou have to change your .conf files of your website. Similar below:
<VirtualHost *:80>
ServerAdmin webmaster@yourwebsite.com
ServerName www.yourwebsite.com
ServerAlias yourwebsite.com
DocumentRoot /var/www/yourwebsite.com/public_html
ErrorLog /var/log/yourwebsite.com-error.log
CustomLog /var/log/yourwebsite.com-requests.log combined
</VirtualHost>
<Directory /var/www/yourwebsite.com/public_html>
Options FollowSymLinks
AllowOverride All
</Directory>
Многие из нас привыкли публиковать базу или веб сервис 1С нажатием нескольких кнопок.
Но не все из многих знают, что для этого необходимо запустить(от имени администратора!) конфигуратор 1С:Предприятие именно на той машине, где установлен веб сервер(а именно компонента веб-расширения 1С:Предприятия).
В случае, если веб-сервер и компонента веб-расширения 1С:Предприятия установлены на машину с ОС Linux без графической оболочки, то публикация через привычное окно конфигуратора становится невозможной.
Аналогичная ситуация возникает, когда на этой машине отсутствует клиент 1С:Предприятия и, следовательно, становится невозможным запуск конфигуратора.
О том, как осуществить публикацию базы можно почитать тут: Публикация 1С на Веб сервере Linux.
Отметим, что при ручной настройке публикации можно допустить различные ошибки. Описания которых и приведены в этой статье.
Итак, что делать, если не получается опубликовать веб-сервис 1С?
Список возможных ошибок:
1. Job for httpd.service failed because the control process exited with error code.
2. Ошибка веб-сервера Apache при публикации 1С «Syntax error on line…»
3. Ошибка «Invalid command ‘ManagedApplicationDescriptor’»
4. Не запускается 1С: Предприятие при подключении через веб сервер Linux. «Selinux policy enabled.»
5. Ошибка HTTP 404 Not found
6. Ошибка Service not found при обращении к веб-сервису 1С:Предприятия
Job for httpd.service failed because the control process exited with error code.
Полный текст ошибки:
Job for httpd.service failed because the control process exited with error code. See «systemctl status httpd.service» and «journalctl -xe» for details. |
Описание ошибки:
После выполнения всех настроек файлов публикации базы или сервиса 1С:Предприятия. При попытке запустить веб-сервер — выдается ошибка и веб-сервер не запускается.
Данное сообщение говорит о том, что процесс был завершен с ошибкой, более подробную информацию о которой можно получить в журнале. Как это сделать — описано далее.
Решение:
Необходимо проанализировать более подробное описание ошибки. Его можно получить следующим образом.
В результате выполнения команды будет выдано более подробное сообщение об ошибке.
Разбор, которых приведен в статье далее.
Ошибка веб-сервера Apache при публикации 1С «Syntax error on line…»
Полный текст ошибки:
сен 16 11:41:54 1s-on-web-1 httpd[6596]: AH00526: Syntax error on line 6 of /etc/httpd/e1c/base.conf: сен 16 11:41:54 1s-on-web-1 httpd[6596]: Invalid command ‘forceHandler’, perhaps misspelled or defined by a module not included in the server configuration |
Описание ошибки:
Ошибка связана с ошибками или «опечатками» в файле настроек base.conf. Иными словами, в данном файле есть некорректные строки, которые новичку бывает сходу не так просто найти.
Решение:
Исправить ошибку в строке сообщения. В данном случае допущена опечатка в имени команды.
vim /etc/httpd/e1c/base.conf |
Пример ошибочной строки. Команды forceHandler — на самом деле не существует :
Alias «/base» «/var/www/e1c/base/» <Directory «/var/www/e1c/base/»> AllowOverride All Options None Require all granted forceHandler 1c-application ManagedApplicationDescriptor «/var/www/e1c/base/default.vrd» </Directory> |
Исправим файл. Укажем корректное наименвоание команды — SetHandler:
Alias «/base» «/var/www/e1c/base/» <Directory «/var/www/e1c/base/»> AllowOverride All Options None Require all granted SetHandler 1c-application ManagedApplicationDescriptor «/var/www/e1c/base/default.vrd» </Directory> |
Ошибка «Invalid command ‘ManagedApplicationDescriptor’»
Полный текст ошибки:
Начат процесс запуска юнита httpd.service. сен 16 12:18:11 1s-on-web-1 httpd[9857]: AH00526: Syntax error on line 7 of /etc/httpd/e1c/base.conf: сен 16 12:18:11 1s-on-web-1 httpd[9857]: Invalid command ‘ManagedApplicationDescriptor’, perhaps misspelled or defined by a module not included in the server configuration сен 16 12:18:11 1s-on-web-1 systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE сен 16 12:18:11 1s-on-web-1 systemd[1]: Failed to start The Apache HTTP Server. — Subject: Ошибка юнита httpd.service |
Описание ошибки:
Ошибка связана с тем, что в файле httpd.conf отсутствует ссылка на модуль веб-расширения 1С:Предприятия, которая должна указываться в «LoadModule _1cws_module».
В этом можно убедиться выполнив команду.
cat /etc/httpd/conf/httpd.conf | grep wsap |
Если результат пустой, то строка вида «/opt/1C/v8.3/x86_64/wsap24.so», отсутвтует — модуль не прописан.
Решение:
Отредактировать конфигурационный файл httpd.conf
vim /etc/httpd/conf/httpd.conf |
Добавить строку:
LoadModule _1cws_module «/opt/1C/v8.3/x86_64/wsap24.so» |
Не запускается 1С: Предприятие при подключении через веб сервер, Linux. «Selinux policy enabled.»
Полный текст ошибки:
cat /var/log/httpd/error_log |
Описание проблемы:
При попытке запустить клиента 1С:Предприятие через веб-сервер (строка подключения вида: «ws=»http://1s-on-server/bast»;») — сеанс не запускается.
Но при этом, таже самая база — запускается успешно при прямом подключении к серверу 1С:Предприятия (строка подключения вида Srvr=»1s-on-server»;Ref=»base»;).
Решение:
1. Убедиться, что selinux, действительно, работает.
Если видим Enforcing, значит переходим к следующему пункту.
2. Отключить selinux:
3. Проверить, что настройка выполнена.
Permissive – включен, но ничего не запрещает.
Enforcing – включен, работает, и запрещает.
Ошибка HTTP 404 Not found
<strong>Пример полного текста ошибки:</strong> 404 Error in Request. HTTP Status: 404 — Not found |
<img class=«wp-image-809» src=«https://1s-on.ru/wp-content/uploads/2020/12/post-802-image-3.jpeg» /> HTTP 404 Not found The webpage cannot be found |
Описание:
После публикации базы на сервере, при попытке перейти по веб-ссылке базы из браузера– выдается ошибка.
Проще говоря, браузер сообщает, что не нашел такой папки публикации на сервере.
Решение:
Ошибка часто связана с неправильным вводом имени базы/папки публикации.
Необходимо проверить имена папок с конфигурационными файлами базы, а также имена базы и папок в самих конфигурационных файлах.
Проверить имена публикации базы(выделено):
1. Конфигурационный файл *.conf:
vim /etc/httpd/e1c/base.conf |
следующего содержания:
Alias «/base» «/var/www/e1c/base/» <Directory «/var/www/e1c/base/»> AllowOverride All Options None Require all granted SetHandler 1c-application ManagedApplicationDescriptor «/var/www/e1c/base/default.vrd» </Directory> |
2. Конфигурационный файл публикации базы *.vrd
vim /var/www/e1c/base/default.vrd |
следующего содержания:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?xml version=»1.0″ encoding=»UTF-8″?> <point xmlns=»http://v8.1c.ru/8.2/virtual-resource-system» xmlns:xs=»http://www.w3.org/2001/XMLSchema» xmlns:xsi=»http://www.w3.org/2001/XMLSchema-instance» base=»/base» ib=»Srvr=1s-on-1c-1; Ref=base»> <ws> <point name=»ws_1s_on_1″ alias=»ws_1s_on_1.1cws» enable=»true»/> <point name=»ws_1s_on_2″ alias=»ws_1s_on_2.1cws» enable=»true»/> </ws> </point> |
point name – имя сервиса в конфигураторе;
alias – это имя ссылки, по которой будем обращаться к веб-сервису.
Именно это имя необходимо вводить в браузер при проверке работы веб-сервиса: 1s-on-1c-1/base/ws/ws_1s_on_1.1cws
Ошибка Service not found при обращении к веб-сервису 1С:Предприятия
Пример полного текста ошибки:
Описание:
При обращении к веб-сервису, после авторизации(если таковая требуется) – возникает ошибка, что сервис не найден. То есть публикация самой базы отвечает, но веб-сервиса нет или он не отвечает.
Ошибка часто связана с ошибками в именах самого веб-сервиса или его ссылки.
Решение:
Проверить имена веб-сервисов и ссылок на них.
-
- Конфигурационный файл публикации базы *.vrd
vim /var/www/e1c/base/default.vrd |
следующего содержания:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?xml version=»1.0″ encoding=»UTF-8″?> <point xmlns=»http://v8.1c.ru/8.2/virtual-resource-system» xmlns:xs=»http://www.w3.org/2001/XMLSchema» xmlns:xsi=»http://www.w3.org/2001/XMLSchema-instance» base=»/base» ib=»Srvr=1s-on-1c-1; Ref=base»> <ws> <point name=»ws_1s_on_1″ alias=»ws_1s_on_1.1cws» enable=»true»/> <point name=»ws_1s_on_2″ alias=»ws_1s_on_2.1cws» enable=»true»/> </ws> </point> |
point name – имя сервиса в конфигураторе;
alias – это имя ссылки, по которой будем обращаться к веб-сервису. Именно это имя необходимо вводить в браузер при проверке работы веб-сервиса.
В нашем случае веб-сервиса ws_1s_on_3.1cws нет в файле.