[3] Nginx Server Setup - Connecting to C++ Web Framework
- 공유 링크 만들기
- X
- 이메일
- 기타 앱
## 0. Researching C++ Web Frameworks To achieve the goal of building a server in C++, I've started by researching suitable C++ web frameworks. According to GPT recommendations, **Drogon** is popular, so I'll proceed with this framework first. --- | Framework | Advantages | Disadvantages | |------------|-------------------------------------------------------------------------------------------|------------------------------------------------------------------| | **Drogon** | Supports modern C++14/17 standards
Asynchronous programming and multi-thread support
Supports HTTP2 and WebSocket
High performance and user-friendly API
Active community and support | Initial setup can be complex due to many features | | **Pistache** | Lightweight design enables quick web server implementation
Suitable for RESTful API development
Simple code and easy to learn | Slow development and updates
Limited functionality | | **Crow** | Intuitive usage similar to Python’s Flask
Includes JSON support and routing functionality
Lightweight design | Limited features, not ideal for complex applications
May lack active maintenance and support | | **CppCMS** | Suitable for high-performance web application development
Provides features like session management and internationalization | Complex setup and steep learning curve
More difficult to use compared to other frameworks, with limited documentation | | **Restbed** | Suitable for lightweight RESTful API development
Asynchronous and scalable design | Limited functionality, not ideal for large-scale projects
Lacks active updates and community support | --- ## 1. Installing Framework Dependencies ``` sudo yum install -y git cmake gcc-c++ libuuid-devel openssl-devel zlib-devel brotli-devel jsoncpp-devel libuuid libuuid-devel ``` If jsoncpp-devel is unavailable, install it separately. --- ### Separate installation of JSONCPP ``` # Download the JSONCPP source code git clone https://github.com/open-source-parsers/jsoncpp.git cd jsoncpp # Create build directory mkdir build cd build # Configure and build using CMake cmake .. -DCMAKE_BUILD_TYPE=Release make -j$(nproc) # Install sudo make install # Link installation path (specify the installed path, in this case, it is /usr/local/lib64) echo "/usr/local/lib64" | sudo tee /etc/ld.so.conf.d/jsoncpp.conf sudo ldconfig # Verification ldconfig -p | grep jsoncpp [root@vbox build] (master) $ ldconfig -p | grep jsoncpp libjsoncpp.so.27 (libc6,x86-64) => /usr/local/lib64/libjsoncpp.so.27 libjsoncpp.so (libc6,x86-64) => /usr/local/lib64/libjsoncpp.so ``` --- ## 2. Building the Framework ``` git clone https://github.com/drogonframework/drogon.git cd drogon mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j$(nproc) sudo make install ``` --- ### Error During Installation ``` CMake Error at CMakeLists.txt:137 (add_subdirectory): The source directory /root/drogon/trantor does not contain a CMakeLists.txt file. ``` - Run the following command: git submodule update --init --recursive - After running the command, go to the build directory and execute: ``` cmake .. -DCMAKE_BUILD_TYPE=Release make -j$(nproc) sudo make install Then rebuild. ``` --- ### 3. Verifying the Framework To check the version: ``` [root@vbox drogon_ctl] (master) $ pwd /root/drogon/build/drogon_ctl [root@vbox drogon_ctl] (master) $ ./drogon_ctl version _ __| |_ __ ___ __ _ ___ _ __ / _` | '__/ _ \ / _` |/ _ \| '_ \ | (_| | | | (_) | (_| | (_) | | | | \__,_|_| \___/ \__, |\___/|_| |_| |___/ A utility for drogon Version: 1.9.8 Git commit: 8541e671430f9605a62f1afbd786c1dbd54197d6 Compilation: Compiler: c++ Compiler ID: GNU Compilation flags: -O3 -DNDEBUG -std=c++17 -I/usr/local/include Libraries: postgresql: no (pipeline mode: no) mariadb: no sqlite3: no ssl/tls backend: OpenSSL brotli: no hiredis: no c-ares: no yaml-cpp: no ``` ### Run the Built Test Server in the Following Directory /root/drogon/build/examples ``` [root@vbox examples] (master) $ ./helloworld 20241103 16:23:09.594785 UTC 52417 INFO Server running on 127.0.0.1:8848 - main.cc:95 20241103 16:23:09.596557 UTC 52418 INFO setBeforeListenSockOptCallback:10 - main.cc:76 ``` --- ### Internal CURL Test ``` [root@vbox ~] $ curl -v 127.0.0.1:8848 * Trying 127.0.0.1:8848... * Connected to 127.0.0.1 (127.0.0.1) port 8848 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1:8848 > User-Agent: curl/7.76.1 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < content-length: 13 < content-type: text/html; charset=utf-8 < server: drogon/1.9.8 < date: Sun, 03 Nov 2024 16:22:09 GMT < * Connection #0 to host 127.0.0.1 left intact ``` --- ### Web Test Reloading NGINX is necessary before running the web test. ``` worker_processes 10; events { worker_connections 1024; use epoll; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; large_client_header_buffers 4 16k; server { listen 10099; server_name localhost; location / { proxy_pass http://localhost:8848; # Proxy to backend server proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } } ``` After modifying the configuration, reload or restart NGINX: ./nginx -s reload" or ./nginx -s stop ./nginx --- ### Verifying Operation Web(10099) -> VM -> NGINX (10099) -> Drogon (8848) This setup confirms the server operates in the above structure.---Related Links
---Recommended Link
개발-EN
C++ server setup
Development
Drogon installation
Drogon server
Drogon setup
nginx
Nginx Server Setup
server setup
- 공유 링크 만들기
- X
- 이메일
- 기타 앱
이 블로그의 인기 게시물
한국 핵무장 논의와 방위산업 관련주: 핵무기 개발 과정과 유망 종목 분석
한국의 독자적 핵무장 논의가 주요 이슈로 떠오르며 방위산업 관련 주식들이 주목받고 있습니다. 특히, 핵무기 및 방어 관련 기술력을 보유한 기업들이 관심을 끌고 있어 투자자들에게 큰 잠재적 수혜가 예상됩니다. 트럼프 전 미국 대통령의 재집권 가능성 등 외교적 변화는 이러한 방위산업 관련주를 더욱 부각시키고 있습니다. ( 참조: https://gussconomy.tistory.com/entry/한국-핵무장-시나리오-관련주-투자-포인트-총정리 ) --- ### 핵무기 생산과정 요약 #### **핵연료 확보** : 고농축 우라늄-235 또는 플루토늄-239와 같은 핵분열 물질을 확보하는 과정입니다. - **우라늄 농축**: 우라늄-235의 비율을 약 90% 이상으로 높이는 과정입니다. - **플루토늄 생산**: 원자로에서 우라늄-238을 중성자로 포획하여 플루토늄을 생성하고 이를 화학적으로 분리합니다. #### **폭발 장치 개발** : 확보한 핵연료를 폭발할 수 있도록 설계된 장치입니다. - **충돌 방식 (Gun-type)**: 고농축 우라늄을 이용해 두 덩어리를 빠르게 결합시켜 핵분열을 유도합니다. - **내부 압축 방식 (Implosion-type)**: 고폭압력으로 플루토늄을 압축하여 임계 질량을 초과하도록 합니다. ####. **무기화 및 배치** - 폭발 장치를 무기 형태로 조립하여 배치 가능한 상태로 만드는 과정입니다. 미사일, 폭격기 등에 탑재될 수 있도록 설계합니다. --- ### 핵심적인 부분 가장 중요한 부분은 **핵연료 확보**와 **폭발 장치 개발**입니다. - **핵연료 확보**: 핵분열 물질 확보가 핵무기 개발의 필수 조건입니다. 우라늄 농축과 플루토늄 생산은 고도의 기술력을 요구하며, 보안과 국제적인 감시가 강화된 부분입니다. - **폭발 장치 개발**: 핵연료가 있어도 이를 효과적으로 폭발시키는 장치가 없다면 무기화가 불가능합니다. 압축 방식 등 폭발 장치 개발 기술이 핵무기의 폭발력...
[로스트아크] 제작 효율 최적화 위한 영지 세팅
### 1. 대성공 확률 증가 vs. 제작 수수료 절감 - **대성공 확률 증가**: 대성공 확률이 2% 증가해도 실제 효과는 크지 않습니다. 예를 들어, 기본 대성공 확률 5%에 2% 증가를 적용해도 실질적인 효과는 0.1% 증가에 불과합니다. - **제작 수수료 절감**: 제작 수수료를 2% 절감할 경우, 제작할 때마다 발생하는 골드 비용을 직접적으로 줄일 수 있어 비용 절약 효과가 훨씬 큽니다. - 결과적으로, 제작 수수료 절감이 대성공 확률 증가보다 약 10배 더 많은 이득을 제공합니다. 따라서 대성공 확률보다는 수수료 절감에 집중하는 것이 권장됩니다. --- ### 2. 효율적인 영지 세팅을 위한 이득 극대화 세팅 - 영지 내 필수 세팅 아이템으로 "곡예사의 대기실," "찬란한 소원 나무," "여신의 가호"가 추천됩니다. - **곡예사의 대기실**: 마리샵에서 블루 크리스탈로 구매할 수 있으며, 기본적인 제작 효율을 높이는 데 필수 아이템입니다. - **찬란한 소원 나무**: 수수료 절감을 제공하여 제작 비용을 절감하는 효과가 있어 이득 극대화에 도움이 됩니다. - **여신의 가호**: 미술품 42개를 모아 획득할 수 있으며, 추가적인 제작 효율을 제공합니다. 여유가 있다면 필수로 장착하는 것이 좋습니다. - 여신의 가호 대신, **곡예사의 무기 진열대**를 구매해 사용할 수도 있으며, 경제적인 선택지로 활용할 수 있습니다. --- ### 3. 의상 세팅 (선택적 적용) - 특정 의상을 착용하면 제작 효율이 약간 증가하지만, 최적의 의상 옵션은 없기 때문에 필수는 아닙니다. 크리스탈 비용이 부담스러울 경우 생략 가능하며, 다른 세팅을 우선적으로 강화하는 것이 좋습니다. - **드레스룸 이용**: 크리스탈을 사용하여 드레스룸에서 특정 NPC와의 호감도로 얻을 수 있는 의상을 구매할 수 있습니다. - **추천 의상**: 페...
[로스트아크] 로스트아크 생활 도구 옵션
### 생활 도구 옵션 및 확률 | **옵션** | **고급** | **희귀** | **영웅** | **전설** | **유물** | |-------------------------|-------------|------------|-------------|-------------|-------------| | 기본 보상 추가 획득률 | 5~10% | 10~20% | 15~30% | 20~40% | 25~50% | | 희귀 재료 획득률 | 5~10% | 10~20% | 15~30% | 20~40% | 25~50% | | 특수 획득 확률 | 0.5~1% | 1~2% | 1.5~3% | 2~4% | 2.5~5% | | 내구도 미차감 확률 | 2.5~5% | 5~10% | 7.5~15% | 10~20% | 12.5~25% | | 채집속도 | 1.25~2.5% | 2.5~5% | 3.75~7.5% | 5~10% | 6.25~12.5% | | 미니게임 난이도 하락 | 1 | 1~2 | 1~2 | 2~3 | 2~3 | | 미니게임 보상 획득 확률 | 5~10% | 10~20% | 15~30% | 20~40% | 25~50% | | 낚시 캐스팅 등급 | 1~2 | 2~4 | 4~6 | 6~8 | 8~10 | --- ### 생활 키트 옵션 정리 - 영웅 등급 생활 도구가 제작 비용면에서 효율 좋음 | **생활 유형** | **필수 옵션 (빨간색)...
댓글
댓글 쓰기