전체 글 (256) 썸네일형 리스트형 PHP: 특정 버전 설치 & Nginx 사용 # php7.4 # php-fpm # apache 제거 Linux (WSL)에서 특정 버전의 PHP를 설치하고Nginx를 사용해서 서버 구성하기 단계는 다음과 같다.1. 특정 버전의 php를 설치하기 위한 준비2. php 설치 (7.4 기준으로 설명) - php와 관련 설치도 포함 (+ php-fpm, php-cli ...)3. nginx 설치 & 실행 - apache로 인해 실행이 안되면 '5. nginx 실행' 으로 진행4. apache 제거 - php를 설치하니 apache가 따라온다. - 나는 원하지 않으니 apache를 제거하고 nginx를 사용5. nginx 실행 - 3에서 apache의 80 포트 사용으로 실패시 다시 실행 * FastCGI server 설정 활성화 PHP 설치 준비1. php 설치 준비sudo apt update 2... Python: script내의 argument(인자) 받는 함수 실행하기 # python -m script_path method args 예제 코드 if __name__ == "__main__": import sys with Database() as db: if len(sys.argv) > 1: method_name = sys.argv[1] method = getattr(db, method_name, None) args = sys.argv[2:] # Get additional arguments if method is not None and callable(method): method(*args) # Pass the arguments to the method el.. PostgreSQL: password 안전하게 사용하기 # PGPASSWORD # .pgpass # .env Python에서 프레임워크가 아닌 Script를 통해 sql문을 사용하는 상황에서create table sql을 작성할 때 DB 접근을 위해 PASSWORD가 필요하다. .env에 기록을 해두고 load_dotenv로 사용할 수 있는데,psql command에 .env에서 불러온 password를 넣는 방식은 보안에 취약할 수 있다.비밀번호 등이 명령어 히스토리에 남을 수 있기 때문이다. 예제코드를 통해 살펴보자import subprocessimport osfrom pathlib import Pathfrom dotenv import load_dotenvload_dotenv()def create_table(): db_user = os.getenv('DB_USER') db_name = os.get.. Python: script 실행시 상위 경로 인식 못하는 문제 # -m option - a.py- b_dir - b.py 위와 같은 파일 구조로 되어있고, b.py에서 a.py에 있는 a_url을 import 해서 쓰는 경우 # b.pyfrom a import a_url 위와 같은 상황에서 VS code의 'Run Python File' 버튼을 누르거나, python b.py 명령어로 실행시키면,No module named 'a' 라는 오류가 나온다.또는 상위 경로에서python a.b 명령어를 실행하면can't open file ... [Errno 2] No such file or directory 오류가 발생한다. 이런 경우에는 a.py가 있는 경로에서 -m 옵션을 주고 실행하면 된다.python -m a.b Windows: 커맨드 단축키 # alias # doskey Linux에서 커맨드를 편하게 사용하기 위해 alias 등록을 할 수 있다. Windows에서도 똑같은 기능을 할 수 있도록 해보자. 기준 shell은 cmd 이다.1. 매크로를 적은 스크립트 작성원하는 경로 (예: C:\aliases.cmd)에 script를 작성한다.@echo offdoskey cd_key=cd %HOME%\Desktop\git\keyboard_ESP32-S3doskey get_idf=call C:\Espressif\frameworks\esp-idf-v5.3.1\export.bat@echo on원하는 명령어를 doskey를 통해 등록한다.@echo off, @echo on 안에 입력하는 것은, cmd 창이 실행될 때, 해당 명령어들이 등록되는 것을 출력하지 않도록 하기 위함이다. (즉.. Nginx: 새로 켰더니 Nginx가 실행이 안되어 있을 때 in Mac brew services start nginx Try re-running the command as root for richer errors.Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/sir/Library/LaunchAgents/homebrew.mxcl.nginx.plist` exited with 5.위 명령어로 nginx가 실행이 안될 때 nginx 만 입력해서 명령어를 날려보자. ChatGPT: with 'nginx' command, server is started. Is it compatible in linux ubuntu? And what is the difference between 'nginx' and .. Nginx: restart in Mac mac에서 웹서버로 nginx를 구동하고 있다.설정 반영을 위해 재시작을 하려는데 homebrew를 통해서 설치해서재시작을 할 때 아래 명령어를 사용할 수 있다고 한다.brew services restart nginx 그럼 아래와 같이 잘 됐다는 메시지가 나오는데==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)==> Successfully started `nginx` (label: homebrew.mxcl.nginx) 이렇게해서 restart가 되지 않는 경우가 있다.그럴 경우 아래 명령어 적용sudo nginx -s reload ChatGPT 와의 질문 내용도 추가When 'brew services restart nginx' command i.. React Native: iOS - FCM # firebase cloud message # Notification # 애플 개발자 등록 react native firebase 라이브러리공식 사이트: https://rnfirebase.io/ import messaging from '@react-native-firebase/messaging';async function handleAfterLogin() { const fcmToken = await messaging().getToken(); ... 로그인 시, 해당 디바이스에서 사용될 fcmToken을 얻기 위해 위와 같은 로직이 있다.Android에서는 추가 설정이 필요 없었는데iOS에서는 아래와 같은 오류가 나온다. Error: [messaging/unregistered] You must be registered for remote messages before calling ge.. 이전 1 2 3 4 5 ··· 32 다음