I'm posting it here in a hope it will help someone else who might need 
clues what should be changed.


   1. echo "10.17.0.12  repository.kaznu.kz" >> /etc/hosts
   2. a2enmod proxy_http proxy_html ssl headers
   3. a2dissite 000-default default-ssl
   4. Overwrite /etc/tomcat9/server.xml with the attached file (server.xml).
   5. Overwrite /etc/apache2/sites-available/repository_kaznu_kz.conf with 
   the attached file (repository_kaznu_kz.conf).
   6. a2ensite repository_kaznu_kz.conf
   7. systemctl restart apache2.service
   8. systemctl restart tomcat9.service
   9. test the frontend (yarn test:rest)
   10. build the frontend
   11. access your backend by visiting https://repository.kaznu.kz/server
   12. access the frontend by visiting https://repository.kaznu.kz


Cheers
On Tuesday, January 10, 2023 at 1:32:57 PM UTC+3 m.kussai...@gmail.com 
wrote:

> I type IP adress in google chrome 10.17.0.12  Apache works
>
> вторник, 10 января 2023 г. в 16:32:21 UTC+6, Мухаметали Кусайынов: 
>
>> I type IP adress in google chrome 10.17.0.12  Apache works
>>
>> вторник, 10 января 2023 г. в 16:20:24 UTC+6, Мухаметали Кусайынов: 
>>
>>> Hello everyone! I really need your help. I can't deploy the website. 
>>> Please help me! My settings below:
>>> Server OS:
>>> *Ubuntu server without GUI*
>>> Ip address server - *10.17.0.12*
>>> I installed* browsh* - is  text-based browser. Dspace was running at* 
>>> localhost:4000*
>>> Frontend directory location:
>>> *~/dspace-angular-dspace-7.4*
>>> Backend directory location:
>>> */dspace*
>>> SSL crt. location:
>>> */dspace/ssl*
>>> I have included ajp connector in tomcat9 server.xml:
>>>   
>>>
>>>
>>>
>>>
>>>
>>> *<Connector port="8080" protocol="HTTP/1.1"              
>>>  minSpareThreads="25"               enableLookups="false"              
>>>  redirectPort="8443"               connectionTimeout="20000"              
>>>  disableUploadTimeout="true"               URIEncoding="UTF-8"/>*
>>>    
>>>
>>>
>>>
>>>
>>> * <Connector protocol="AJP/1.3"               address="::1"              
>>>  port="8009"               redirectPort="8443"              
>>>  URIEncoding="UTF-8" />*
>>>
>>> local.cfg location:
>>> */dspace/config$*
>>> *Local.cfg configuration*
>>> dspace.dir=*/dspace*
>>> dspace.server.url = *https://repository.kaznu.kz/server 
>>> <https://repository.kaznu.kz/server>*
>>> dspace.ui.url = *https://repository.kaznu.kz 
>>> <https://repository.kaznu.kz>*
>>> dspace.name = *DSpace KazNU*
>>>
>>> *Config.prod.yml configuration*
>>> config.prod.yml location:
>>> *~/dspace-angular-dspace-7.4/config$ *
>>> *ui:*
>>>   ssl: false
>>>   host: localhost
>>>   port: 4000
>>>   nameSpace: /
>>>
>>> *rest:*
>>>   ssl: true
>>>   host: repository.kaznu.kz
>>>   port: 443
>>>   nameSpace: /server
>>>
>>> Next, I will describe in detail how I tried to create a VirtualHost for 
>>> Dspace.
>>> I copied the *default-ssl.conf *and created the 
>>> *repository_kaznu_kz.conf*  in */etc/apache2/sites-available* directory.
>>>
>>> VirtualHost apache2 located:
>>> */etc/apache2/sites-available/repository_kaznu_kz.conf*
>>> Did I write the configuration file VirtualHosts correctly?
>>> It seems to me that somewhere I could be mistaken. If I'm wrong, can you 
>>> show me how to correctly write the VirtualHost configuration? Complete 
>>> VirtualHost Configuration:
>>> *VirtualHost setting*
>>> <IfModule mod_ssl.c>
>>>         <VirtualHost _default_:443>
>>>                 ServerAdmin webmaster@localhost
>>>     DocumentRoot /var/www/html
>>>                 
>>>     ServerName repository.kaznu.kz
>>>                 
>>>                 ErrorLog ${APACHE_LOG_DIR}/error.log
>>>                 CustomLog ${APACHE_LOG_DIR}/access.log combined
>>>           
>>>         SSLEngine on
>>>                 SSLCertificateFile      /dspace/ssl/STAR_kaznu_kz.crt
>>>                 SSLCertificateKeyFile /dspace/ssl/STAR_kaznu_kz.key
>>>
>>>          # Proxy all HTTPS requests to "/server" from Apache to Tomcat 
>>> via AJP connector
>>>                 ProxyPass /server ajp://localhost:8009/server
>>>                 ProxyPassReverse /server ajp://localhost:8009/server
>>>
>>>         # Proxy all HTTPS requests from Apache to PM2 on localhost, port 
>>> 4000
>>>                 ProxyPass / http://localhost:4000/
>>>                 ProxyPassReverse / http://localhost:4000/
>>>
>>>          #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
>>>                 <FilesMatch "\.(cgi|shtml|phtml|php)$">
>>>                                 SSLOptions +StdEnvVars
>>>                 </FilesMatch>
>>>                 <Directory /usr/lib/cgi-bin>
>>>                                 SSLOptions +StdEnvVars
>>>                 </Directory>
>>>        </VirtualHost>
>>> </IfModule>
>>>
>>>
>>> Next, I wrote the command - *sudo a2ensite repository_kaznu_kz.conf*
>>> And then, I wrote the command - *sudo systemctl restart apache2*
>>> Status apache2:
>>>
>>> ● apache2.service - The Apache HTTP Server
>>>      Loaded: loaded (/lib/systemd/system/apache2.service; enabled; 
>>> vendor preset: enabled)
>>>      Active: active (running) since Tue 2023-01-10 09:58:56 UTC; 13min 
>>> ago
>>>        Docs: https://httpd.apache.org/docs/2.4/
>>>     Process: 950 ExecStart=/usr/sbin/apachectl start (code=exited, 
>>> status=0/SUCCESS)
>>>    Main PID: 1081 (apache2)
>>>       Tasks: 55 (limit: 9442)
>>>      Memory: 11.1M
>>>      CGroup: /system.slice/apache2.service
>>>              ├─1081 /usr/sbin/apache2 -k start
>>>              ├─1082 /usr/sbin/apache2 -k start
>>>              └─1083 /usr/sbin/apache2 -k start
>>>
>>> Jan 10 09:58:54 dspace7 systemd[1]: Starting The Apache HTTP Server...
>>> Jan 10 09:58:56 dspace7 apachectl[1010]: AH00558: apache2: Could not 
>>> reliably determine the server's fully qualified domain name, using 
>>> 127.0.1.1. Set the 'ServerNam>
>>> Jan 10 09:58:56 dspace7 systemd[1]: Started The Apache HTTP Server.
>>>
>>> I also opened port 443:
>>>
>>> *sudo ufw enable*
>>> *sudo ufw allow ssh*
>>> *sudo ufw allow 443*
>>> As a result it shows:
>>> Status: active
>>>
>>> To                         Action      From
>>> --                         ------      ----
>>> 22/tcp                     ALLOW       Anywhere
>>> 443                        ALLOW       Anywhere
>>> Apache Full                ALLOW       Anywhere
>>> 22/tcp (v6)                ALLOW       Anywhere (v6)
>>> 443 (v6)                   ALLOW       Anywhere (v6)
>>> Apache Full (v6)           ALLOW       Anywhere (v6)
>>>
>>> After this setup, when I again type localhost:4000 again in browsh, my 
>>> site stops working and throws the following error:
>>>
>>> *500*
>>> *Service Unavailable*
>>> *The server is temporarily unable to service your request due to 
>>> maintenanse downtime or capasity problems. Please try again later.*
>>>
>>>
>>> I deployed the repository for the first time and I can't fully 
>>> understand what I'm doing wrong. I've been trying to do this for two months 
>>> and already despaired. Can you describe step by step how to properly deploy 
>>> Dspace 7.4? Please. Sincerely, Kusainov M.
>>>
>>>
>>>

-- 
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/cecf5b07-a997-42a7-86ac-2d794886e607n%40googlegroups.com.
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="-1" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!-- APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <!--<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" /> -->

    <Connector address="127.0.0.1" port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               maxHttpHeaderSize="65536"
               minSpareThreads="25"
               enableLookups="false"
               disableUploadTimeout="true"
               URIEncoding="UTF-8"/>

    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    
	<!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="/dspace/ssl/TSECert.key"
                         certificateFile="/dspace/ssl/TSECert.crt"
                         certificateChainFile="/dspace/ssl/CAtse.crt"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <!--
    <Connector protocol="AJP/1.3"
               address="::1"
               port="8009"
               redirectPort="8443" />
    -->

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />

      </Host>
    </Engine>
  </Service>
</Server>
<VirtualHost *:80>
     ServerName repository.kaznu.kz
     Redirect / https://repository.kaznu.kz
</VirtualHost>

<VirtualHost *:443>
     ServerName repository.kaznu.kz
     LogLevel warn
     ErrorLog ${APACHE_LOG_DIR}/repository.kaznu.kz.error.log
     CustomLog ${APACHE_LOG_DIR}/repository.kaznu.kz.access.log combined
     ProxyRequests on
     SSLEngine on
     SSLProxyEngine on
     SSLCertificateFile /dspace/ssl/STAR_kaznu_kz.crt
     SSLCertificateKeyFile /dspace/ssl/STAR_kaznu_kz.key
     SSLCompression off
     SSLProtocol             all -SSLv3 -TLSv1 -TLSv1.1
     SSLCipherSuite          
ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
     SSLHonorCipherOrder     off
     SSLSessionTickets       off
     ProxyPreserveHost on
     RequestHeader set X-Forwarded-Proto https

   <Proxy *>
       AddDefaultCharset Off
       Require all granted
   </Proxy>

     ProxyPass /server http://localhost:8080/server
     ProxyPassReverse /server http://localhost:8080/server
     ProxyPass / http://localhost:4000/
     ProxyPassReverse / http://localhost:4000/

</VirtualHost>

Reply via email to