klitchevo
klitchevo
Explore posts from servers
RRailway
Created by klitchevo on 11/10/2024 in #✋|help
Update php.ini when using Wordpress image
As title says, I need to update php.ini to these values: RUN echo "upload_max_filesize = 128M" >> /usr/local/etc/php/php.ini RUN echo "post_max_size = 128M" >> /usr/local/etc/php/php.ini RUN echo "max_execution_time = 300" >> /usr/local/etc/php/php.ini RUN echo "max_input_time = 300" >> /usr/local/etc/php/php.ini How can I do this? I am using wordpress image, I do not have any code on local machine
6 replies
RRailway
Created by klitchevo on 8/4/2024 in #✋|help
Nginx won't redirect to index.html
I have a react project that I am deploying to railway. When I access its root route, it works fine, but whenever I try to go to for example /profile and refresh page I get 404. Here is my nginx config
events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;

location / {
try_files '' /index.html =404;
}

# Cache control for static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
add_header Cache-Control "public, max-age=31536000";
}

# Error page
error_page 404 /index.html;
}
}
events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;

location / {
try_files '' /index.html =404;
}

# Cache control for static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
add_header Cache-Control "public, max-age=31536000";
}

# Error page
error_page 404 /index.html;
}
}
and here is my Dockerfile:
# Stage 1: Build the Vite application
FROM node:18-alpine AS builder

# Set working directory
WORKDIR /app

# Install pnpm globally
RUN npm install -g pnpm

# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./

# Install dependencies
RUN pnpm install

# Copy the rest of the application code
COPY . .

# Build the application
RUN pnpm run build

# Stage 2: Serve the application using Nginx
FROM nginx:alpine

# Copy the built application from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html

# Copy the Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf

# Expose port 80
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
# Stage 1: Build the Vite application
FROM node:18-alpine AS builder

# Set working directory
WORKDIR /app

# Install pnpm globally
RUN npm install -g pnpm

# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./

# Install dependencies
RUN pnpm install

# Copy the rest of the application code
COPY . .

# Build the application
RUN pnpm run build

# Stage 2: Serve the application using Nginx
FROM nginx:alpine

# Copy the built application from the builder stage
COPY --from=builder /app/dist /usr/share/nginx/html

# Copy the Nginx configuration file
COPY nginx.conf /etc/nginx/nginx.conf

# Expose port 80
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
any ideas? Also is it worth exploring caddy for this use case maybe?
20 replies